Fixed boot / partuuid breaking issues
-Skip Grube
This commit is contained in:
parent
eb0c36e9e8
commit
e215091a77
@ -39,12 +39,18 @@ kpartx -av "${image}"
|
|||||||
|
|
||||||
# Get the loop partition; it might be loop0p3, loop1p3, ...
|
# Get the loop partition; it might be loop0p3, loop1p3, ...
|
||||||
looppart=$(kpartx -l "${image}" | awk '/p3/{print $1}')
|
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)}')
|
|
||||||
|
|
||||||
# Mount the /boot partition (swap the 3rd partition for the first):
|
# 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 '{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/')
|
||||||
|
|
||||||
umount /mnt/tmp
|
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"
|
# Swap out the "root=" part of cmdline.txt for our "root=UUID=blah"
|
||||||
sed -i "s/root= /root=${partuuid} /" /mnt/tmp/cmdline.txt
|
sed -i "s/root= /root=${partuuid} /" /mnt/tmp/cmdline.txt
|
||||||
|
Loading…
Reference in New Issue
Block a user