Commit e215091a authored by Skip Grube's avatar Skip Grube
Browse files

Fixed boot / partuuid breaking issues

-Skip Grube
parent eb0c36e9
......@@ -39,12 +39,18 @@ kpartx -av "${image}"
# Get the loop partition; it might be loop0p3, loop1p3, ...
looppart=$(kpartx -l "${image}" | awk '/p3/{print $1}')
# Get the UUID of our root partition (the ext4 one) (UUID=e3984938429 , strip out quotes("), and force upper case)
partuuid=$(blkid | grep "mapper/${looppart}" | head -1 | awk '{gsub(/\"/,"", $NF); print toupper($0)}')
partuuid=$(blkid | grep "mapper/${looppart}" | head -1 | awk '{print $NF}' | tr -d '"' | tr '[:lower:]' '[:upper:]')
# Get the boot partition and mount it
# (change 3rd partition for 1st, so loop0p3 becomes loop0p1):
bootloop=$(echo "${looppart}" | sed 's/p3$/p1/')
# Mount the /boot partition (swap the 3rd partition for the first):
umount /mnt/tmp
mount /dev/mapper/${looppart/3/1} /mnt/tmp
mount /dev/mapper/${bootloop} /mnt/tmp
# Swap out the "root=" part of cmdline.txt for our "root=UUID=blah"
sed -i "s/root= /root=${partuuid} /" /mnt/tmp/cmdline.txt
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment