summaryrefslogtreecommitdiff
path: root/export-image/04-set-partuuid
diff options
context:
space:
mode:
authorSerge Schneider <serge@raspberrypi.com>2022-03-18 17:03:26 +0000
committerSerge Schneider <serge@raspberrypi.com>2022-03-21 08:37:25 +0000
commitb0316ae8706e3abe0d4bd2bdf1cda976a6e2e6a7 (patch)
tree31c596c8795a2151200955cb9dd5000491abbba7 /export-image/04-set-partuuid
parent95ac3cfb3b223dad058c1aee1d8b6e3f5e5b5935 (diff)
Enable userconf-pi on first boot
Diffstat (limited to 'export-image/04-set-partuuid')
-rwxr-xr-xexport-image/04-set-partuuid/00-run.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/export-image/04-set-partuuid/00-run.sh b/export-image/04-set-partuuid/00-run.sh
new file mode 100755
index 0000000..16e1b15
--- /dev/null
+++ b/export-image/04-set-partuuid/00-run.sh
@@ -0,0 +1,18 @@
+#!/bin/bash -e
+
+if [ "${NO_PRERUN_QCOW2}" = "0" ]; then
+
+ IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
+
+ IMGID="$(dd if="${IMG_FILE}" skip=440 bs=1 count=4 2>/dev/null | xxd -e | cut -f 2 -d' ')"
+
+ BOOT_PARTUUID="${IMGID}-01"
+ ROOT_PARTUUID="${IMGID}-02"
+
+ sed -i "s/BOOTDEV/PARTUUID=${BOOT_PARTUUID}/" "${ROOTFS_DIR}/etc/fstab"
+ sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${ROOTFS_DIR}/etc/fstab"
+
+ sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${ROOTFS_DIR}/boot/cmdline.txt"
+
+fi
+