aboutsummaryrefslogtreecommitdiffstats
path: root/export-noobs/00-release/files/partition_setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'export-noobs/00-release/files/partition_setup.sh')
-rw-r--r--export-noobs/00-release/files/partition_setup.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/export-noobs/00-release/files/partition_setup.sh b/export-noobs/00-release/files/partition_setup.sh
new file mode 100644
index 0000000..3a7dcf9
--- /dev/null
+++ b/export-noobs/00-release/files/partition_setup.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -ex
+
+if [ -z "$part1" ] || [ -z "$part2" ]; then
+ printf "Error: missing environment variable part1 or part2\n" 1>&2
+ exit 1
+fi
+
+mkdir -p /tmp/1 /tmp/2
+
+mount "$part1" /tmp/1
+mount "$part2" /tmp/2
+
+sed /tmp/1/cmdline.txt -i -e "s|root=/dev/[^ ]*|root=${part2}|"
+sed /tmp/2/etc/fstab -i -e "s|^.* / |${part2} / |"
+sed /tmp/2/etc/fstab -i -e "s|^.* /boot |${part1} /boot |"
+
+if ! grep -q resize /proc/cmdline; then
+ sed -i 's/ quiet init=.*$//' /tmp/1/cmdline.txt
+fi
+
+umount /tmp/1
+umount /tmp/2