Drewsif / PiShrink

Make your pi images smaller!
MIT License
3.51k stars 645 forks source link

[suggested fix]image with read-only filesystem won't autoexpand #227

Open OhSoGood opened 2 years ago

OhSoGood commented 2 years ago

Hi

Thank you very much for your script. It's very useful.

The image I created has its filesystem mounted as read-only. As a consequence, the /etc/rc.local created by your script won't manage to expand the filesystem on the first boot of the Pi.

A simple solution is to modify set_autoexpand in order to check if the filesystem is mounted as readonly or not, and if so to remount it. Or even to directly remount the filesystem (if it was already read/write, it changes nothing).

So a simple mount -o remount,rw / is enough If needed, to determine if / is "ro" or "rw": mount | sed -n -e 's/^\/dev\/. on \/ .((r[w|o]).*/\1/p'

Could you add it to your script?