summaryrefslogtreecommitdiff
path: root/export-image/03-set-partuuid
diff options
context:
space:
mode:
Diffstat (limited to 'export-image/03-set-partuuid')
-rwxr-xr-xexport-image/03-set-partuuid/00-run.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/export-image/03-set-partuuid/00-run.sh b/export-image/03-set-partuuid/00-run.sh
new file mode 100755
index 0000000..f19884e
--- /dev/null
+++ b/export-image/03-set-partuuid/00-run.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+IMG_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.img"
+
+IMGID="$(fdisk -l ${IMG_FILE} | sed -n 's/Disk identifier: 0x\([^ ]*\)/\1/p')"
+
+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