]> git.kernelconcepts.de Git - meta-kc-bsp.git/blob - recipes-bsp/startup/custom-firststart/firststart.sh
custom-firststart: add sysvinit service to run scripts on first boot
[meta-kc-bsp.git] / recipes-bsp / startup / custom-firststart / firststart.sh
1 #!/bin/sh
2 #
3
4 DIR="/#SYSCONFDIR#/firststart.d"
5 DIR_OVERLAY_LOWER="/media/rfs/ro"
6
7 remove_startup_link () {
8         if [ -n "`which update-rc.d`" ]; then
9                 update-rc.d -f firststart remove
10         fi
11 }
12
13 if ! [ -d $DIR ]; then
14         remove_startup_link
15         exit 0
16 fi
17
18 echo "Running first boot tasks...."
19
20 run-parts $DIR
21
22 # check if we have a ro overlay or if we can write changes directly
23 if [ -e "/media/rfs/ro" ]; then
24 # using meta-readonly-rootfs-overlay
25         mount $DIR_OVERLAY_LOWER -o remount,rw
26         rm -r $DIR_OVERLAY_LOWER/$DIR
27         rm $DIR_OVERLAY_LOWER/#SYSCONFDIR#/rc*.d/S*firststart
28         rm $DIR_OVERLAY_LOWER/#SYSCONFDIR#/init.d/firststart
29         mount $DIR_OVERLAY_LOWER -o remount,ro
30 else 
31         rm -rf $DIR
32         remove_startup_link
33 fi
34