1
0
mirror of https://github.com/j-a-n/raspberrymatic-addon-rmupdate.git synced 2023-10-10 13:37:40 +02:00

Create new bootfs

This commit is contained in:
Jan Schneider 2018-01-24 00:57:48 +01:00
parent ee64ba109d
commit b38947ce18

View File

@ -58,22 +58,39 @@ losetup /dev/loop${LOOP_DEV} $new_image_file
kpartx -a /dev/loop${LOOP_DEV}
ln -s /dev/loop${LOOP_DEV} /dev/mapper/loop${LOOP_DEV}p
#fsck.vfat -a /dev/mapper/loop${LOOP_DEV}p1
fatresize --size $BOOT_SIZE /dev/mapper/loop${LOOP_DEV}p1
fsck.ext4 -f -y /dev/mapper/loop${LOOP_DEV}p2
resize2fs /dev/mapper/loop${LOOP_DEV}p2
tune2fs -L rootfs1 /dev/mapper/loop${LOOP_DEV}p2
mkfs.ext4 -L rootfs2 /dev/mapper/loop${LOOP_DEV}p3
fsck.ext4 -f -y /dev/mapper/loop${LOOP_DEV}p4
resize2fs /dev/mapper/loop${LOOP_DEV}p4
sleep 3
partuuid=$(blkid -s PARTUUID -o value /dev/mapper/loop${LOOP_DEV}p2)
echo "PARTUUID=${partuuid}"
mkdir /tmp/rmupdate.mnt
mount /dev/mapper/loop${LOOP_DEV}p1 /tmp/rmupdate.mnt
(cd /tmp/rmupdate.mnt; tar cf /tmp/rmupdate.boot.tar .)
umount /tmp/rmupdate.mnt
mkfs.vfat -F32 -n bootfs /dev/mapper/loop${LOOP_DEV}p1
mount /dev/mapper/loop${LOOP_DEV}p1 /tmp/rmupdate.mnt
(cd /tmp/rmupdate.mnt; tar xf /tmp/rmupdate.boot.tar .)
sed -i -r s"/root=\S+/root=PARTUUID=${partuuid}/" /tmp/rmupdate.mnt/cmdline.txt
umount /tmp/rmupdate.mnt
rm /tmp/rmupdate.boot.tar
rmdir /tmp/rmupdate.mnt
#fsck.vfat -a /dev/mapper/loop${LOOP_DEV}p1
#fatresize --size $BOOT_SIZE /dev/mapper/loop${LOOP_DEV}p1
sleep 3
fsck.ext4 -f -y /dev/mapper/loop${LOOP_DEV}p2 || true
resize2fs /dev/mapper/loop${LOOP_DEV}p2
tune2fs -L rootfs1 /dev/mapper/loop${LOOP_DEV}p2
sleep 3
mkfs.ext4 -L rootfs2 /dev/mapper/loop${LOOP_DEV}p3 || true
sleep 3
fsck.ext4 -f -y /dev/mapper/loop${LOOP_DEV}p4 || true
resize2fs /dev/mapper/loop${LOOP_DEV}p4
rm /dev/mapper/loop${LOOP_DEV}p
kpartx -d /dev/loop${LOOP_DEV}
losetup -d /dev/loop${LOOP_DEV}