]> git.kernelconcepts.de Git - meta-kc-bsp.git/blob - recipes-bsp/startup/custom-firststart/firststart.sh
custom-firststart: run scripts with rw lower
[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 # check if we have a ro overlay or if we can write changes directly
19 if [ -e "$DIR_OVERLAY_LOWER" ]; then
20 # using meta-readonly-rootfs-overlay
21         mount $DIR_OVERLAY_LOWER -o remount,rw
22
23         run-parts $DIR
24
25         rm -r $DIR_OVERLAY_LOWER/$DIR
26         rm $DIR_OVERLAY_LOWER/#SYSCONFDIR#/rc*.d/S*firststart
27         rm $DIR_OVERLAY_LOWER/#SYSCONFDIR#/init.d/firststart
28         mount $DIR_OVERLAY_LOWER -o remount,ro
29 else 
30         run-parts $DIR
31
32         rm -rf $DIR
33         remove_startup_link
34 fi
35