Drewsif / PiShrink

Make your pi images smaller!
MIT License
3.47k stars 642 forks source link

Filesystem not expanding if rc.local does not exist #270

Closed strooooke closed 3 weeks ago

strooooke commented 10 months ago

Sort of follow-up on https://github.com/Drewsif/PiShrink/issues/267 - if /etc/rc.local does not exist originally, then it won't get created.

Issue seems to be a misplaced fi:

The block in lines 91/92 (if .../etc/rc.local exists but doesn't have exactly our content...) has its closing fi sit far down, in line 161, after writing the /etc/rc.local and making it executable.

What's suggested by the indentation, and would make sense to me, is moving the fi below line 92. Then we always get /etc/rc.local creation.

Or adding the or doesn't exist check in line 91 - and maybe indenting the whole block ;)

(The question whether just putting an /etc/rc.local in will work is a different one, and depends on whether your image will actually run /etc/rc.local, but that is a different problem that can be solved by modifying the image appropriately before pulling it).

Drewsif commented 3 weeks ago

I swapped around some of the logic since this issue was opened, but the main problem is that if there is no /etc/rc.local there is a very good chance that systemd is going to ignore it. And I'd rather display the error and let them modify the image to begin with. I did not look into if we can force systemd to add the rc.local compatibility service without actually running any of the binaries (since they would be arm). But that could be worth looking into for sure

Drewsif commented 3 weeks ago

After thinking about it more I think you're right. Might as well yolo try and see if it works. Changed in 9c4b103