I am currently creating a very minimal image for the Raspberry Pi 4. And I need the image itself to be as small as possible in order to reduce the time to flash the SD-card.
I do however, want to expand the file-system automatically when the Raspberry Pi 4 first boot.
I just threw this into a bash-script:
#!/bin/bash -x -e
raspi-config nonint do_expand_rootfs
rm -- "$0"
reboot
Running this works, but how to I run this just once when the Pi boots?