aboutsummaryrefslogtreecommitdiffstats
path: root/export-image/03-set-partuuid/00-run.sh
diff options
context:
space:
mode:
authorSerge Schneider <[email protected]>2017-03-07 15:13:22 +0000
committerSerge Schneider <[email protected]>2017-03-07 15:14:03 +0000
commit718a4e8c21289f99ad542faf11bc2e4d769291cc (patch)
tree420384482de75ae14d186c592a4feac324898325 /export-image/03-set-partuuid/00-run.sh
parent8e74b4f15cee8e4b794d0c916cd34f22d5ccfcd9 (diff)
Switch to PARTUUID
Diffstat (limited to 'export-image/03-set-partuuid/00-run.sh')
-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