Below is a snippet of what I use. It works on any version of Raspberry Pi OS.
This snippet assumes the ROOT partition is mounted on /mnt and the BOOT partition is mounted on /mnt/boot (non-Bookworm) or /mnt/boot/firmware (Bookworm).
This snippet assumes the ROOT partition is mounted on /mnt and the BOOT partition is mounted on /mnt/boot (non-Bookworm) or /mnt/boot/firmware (Bookworm).
Code:
#!/bin/bashMNTPATH="/mnt"BOOTMNT="${MNTPATH}$(sed -n 's|^\S\+\s\+\(/boot\S*\)\s\+.*$|\1|p' ${MNTPATH}/etc/fstab)"sed -i 's| init=/usr/lib/raspi-config/init_resize\.sh||' "${BOOTMNT}/cmdline.txt"if [ -f "${MNTPATH}/usr/lib/raspberrypi-sys-mods/firstboot" ]; then cp "${MNTPATH}/usr/lib/raspberrypi-sys-mods/firstboot" "${MNTPATH}/usr/lib/raspberrypi-sys-mods/first-boot" sed -i 's|firstboot|first-boot|g' "${MNTPATH}/usr/lib/raspberrypi-sys-mods/first-boot" sed -i 's|^\(\s*whiptail --infobox \"Resizing root filesystem.*\)$| return 0\n\n\1|' "${MNTPATH}/usr/lib/raspberrypi-sys-mods/first-boot" sed -i 's| init=/usr/lib/raspberrypi-sys-mods/firstboot| init=/usr/lib/raspberrypi-sys-mods/first-boot|' "${BOOTMNT}/cmdline.txt"fi
Statistics: Posted by RonR — Wed Dec 06, 2023 3:49 am