Page 1 of 1

Run script on first boot only

Posted: Sat Mar 05, 2016 1:02 am
by gulliverrr
Hello and congrats on the 4th year of this great toy!
I need to be running a shell script as root on the first boot only automatically without having to logo on to RasPi to run it manually. It is a script that expands the partitions of my SD card to cover the whole area.
What is the best method to do that? It needs to remove itself once its completed to avoid running again on a reboot.

Thanks!

Re: Run script on first boot only

Posted: Sat Mar 05, 2016 7:00 pm
by r3d4
Apparently raspi-config.sh uses ( this : http://elinux.org/RPi_raspi-config#First-boot_activity ) method .

Another method to auto run a program after boot ...

Re: Run script on first boot only

Posted: Tue Aug 27, 2019 1:43 am
by nmcclain
I ran into a similar requirement and created this lightly-modified version of Raspberian-light: https://github.com/nmcclain/raspberian-firstboot

If you create a /boot/firstboot.sh script on the image before flashing to an SD card, it will be executed when it's first booted on a Pi.

Re: Run script on first boot only

Posted: Mon Sep 23, 2019 10:52 pm
by iandk
Would be awesome if this could be officially integrated.

Re: Run script on first boot only

Posted: Fri Nov 01, 2019 12:33 am
by cmh
I would _love_ to see the firstboot script be officially integrated. Thank you for making that work public, nmcclain!