Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Commit

Permalink
Use lsblk to find root partition. This supports SSD booting as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
sgielen committed Sep 14, 2022
1 parent df392e0 commit b3ed5f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ dl_dep libc6-arm64.deb https://launchpadlibrarian.net/365857916/libc6_2.27-3ubun
dl_dep busybox-arm64.deb https://launchpadlibrarian.net/414117084/busybox_1.27.2-2ubuntu3.2_arm64.deb
dl_dep libcom-err2-arm64.deb https://launchpadlibrarian.net/444344115/libcom-err2_1.44.1-1ubuntu1.2_arm64.deb
dl_dep libblkid1-arm64.deb https://launchpadlibrarian.net/438655401/libblkid1_2.31.1-0.4ubuntu3.4_arm64.deb
dl_dep libmount1-arm64.deb https://launchpadlibrarian.net/497838944/libmount1_2.31.1-0.4ubuntu3.7_arm64.deb
dl_dep libsmartcols1-arm64.deb https://launchpadlibrarian.net/497838945/libsmartcols1_2.31.1-0.4ubuntu3.7_arm64.deb
dl_dep libuuid1-arm64.deb https://launchpadlibrarian.net/438655406/libuuid1_2.31.1-0.4ubuntu3.4_arm64.deb
dl_dep libext2fs2-arm64.deb https://launchpadlibrarian.net/444344116/libext2fs2_1.44.1-1ubuntu1.2_arm64.deb
dl_dep e2fsprogs-arm64.deb https://launchpadlibrarian.net/444344112/e2fsprogs_1.44.1-1ubuntu1.2_arm64.deb
Expand Down Expand Up @@ -351,6 +353,8 @@ unpack_deb "libdevmapper1-arm64.deb" "root-resize"
unpack_deb "libselinux1-arm64.deb" "root-resize"
unpack_deb "libudev1-arm64.deb" "root-resize"
unpack_deb "libpcre3-arm64.deb" "root-resize"
unpack_deb "libmount1-arm64.deb" "root-resize"
unpack_deb "libsmartcols1-arm64.deb" "root-resize"

sudo tar -cJf root/root-resize.tar.xz "root-resize"
sudo rm -rf root-resize
Expand Down
3 changes: 2 additions & 1 deletion init.resizefs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ resize2fs $ROOTDEVICE
sleep 5

echo "== Setting proper init... =="
ROOTPARTITION=$(lsblk -o NAME -lnp "${ROOTDISK}" | awk 'NR==2')
if [ "$IMAGE_TYPE" = "raspberrypi" ]; then
mount ${ROOTDISK}p1 /boot
mount ${ROOTPARTITION} /boot
sed -i 's# init=/sbin/init.resizefs# init=/sbin/init.preinit#' /boot/cmdline.txt
NEW_PARTUUID=$(blkid -o export $ROOTDEVICE | grep PARTUUID)
sed -i "s# root=PARTUUID=$PARTUUID # root=$NEW_PARTUUID #" /boot/cmdline.txt
Expand Down

0 comments on commit b3ed5f1

Please sign in to comment.