]> git.kernelconcepts.de Git - meta-kc-bsp.git/blob - recipes-bsp/startup/custom-firststart/firststart.sh
layer.conf: Add support for hardknott
[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         echo Mounting rootfs lower rw
22         mount $DIR_OVERLAY_LOWER -o remount,rw
23
24         echo Running write tasks...
25         run-parts $DIR
26
27         rm -r $DIR_OVERLAY_LOWER/$DIR
28         rm $DIR_OVERLAY_LOWER/#SYSCONFDIR#/rc*.d/S*firststart
29         rm $DIR_OVERLAY_LOWER/#SYSCONFDIR#/init.d/firststart
30         sync
31         echo Mounting rootfs lower ro
32         mount $DIR_OVERLAY_LOWER -o remount,ro > /dev/null 2>&1
33 else 
34         run-parts $DIR
35
36         rm -rf $DIR
37         remove_startup_link
38 fi
39