aboutsummaryrefslogtreecommitdiffstats
path: root/export-image/03-set-partuuid/00-run.sh
blob: 16e1b158ef08041132b2976704acf1e8095b531b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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