gulliverrr
Posts: 38
Joined: Wed Jan 02, 2013 1:38 pm

Run script on first boot only

Sat Mar 05, 2016 1:02 am

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!

User avatar
r3d4
Posts: 968
Joined: Sat Jul 30, 2011 8:21 am
Location: ./

Re: Run script on first boot only

Sat Mar 05, 2016 7:00 pm

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 ...

nmcclain
Posts: 1
Joined: Tue Aug 27, 2019 1:41 am

Re: Run script on first boot only

Tue Aug 27, 2019 1:43 am

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.

iandk
Posts: 7
Joined: Tue Sep 10, 2019 4:42 pm

Re: Run script on first boot only

Mon Sep 23, 2019 10:52 pm

Would be awesome if this could be officially integrated.

cmh
Posts: 2
Joined: Thu Feb 19, 2015 1:51 am

Re: Run script on first boot only

Fri Nov 01, 2019 12:33 am

I would _love_ to see the firstboot script be officially integrated. Thank you for making that work public, nmcclain!

Return to “Raspbian”