surpport seeking the recorded video
[vuplus_openembedded] / recipes / initscripts / initscripts-slugos_1.0.bb
1 # SlugOS specific stuff for the init scripts.
2 #
3 # This is, in effect, an extended patch to fix various problems
4 # in the initscripts on SlugOS.  The problems mostly come down
5 # to the order in which the scripts are executed.
6
7 include initscripts_${PV}.bb
8
9 RCONFLICTS = "initscripts"
10
11 # SlugOS uses the busybox makedevs, so until that dependency gets virtualized
12 # the below lines serve to remove the dependency on the full makedevs package:
13 DEPENDS = ""
14 RDEPENDS = ""
15
16 # All other standard definitions inherited from initscripts
17 # Except the PR which is hacked here.  The format used is
18 # a suffix
19 PR := "${PR}.22"
20
21 # We wish to search the same file paths as does the initscripts recipe.
22 FILESPATHPKG = "initscripts-${PV}:initscripts:files"
23
24 PACKAGES = "${PN}-dbg ${PN}"
25
26 SRC_URI += "file://alignment.sh"
27 SRC_URI += "file://domainname.sh"
28 SRC_URI += "file://bootclean.sh"
29
30 # Without this it is not possible to patch checkroot
31 S = "${WORKDIR}"
32
33 do_install_append() {
34         # devfs is not used with SlugOS - remove all traces of it.
35         rm      ${D}${sysconfdir}/init.d/devices
36         rm      ${D}${sysconfdir}/rcS.d/S05devices
37
38         # slugos specific scripts
39         install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d
40         install -m 0755 ${WORKDIR}/domainname.sh ${D}${sysconfdir}/init.d
41         install -m 0755 ${WORKDIR}/bootclean.sh ${D}${sysconfdir}/init.d
42         install -m 0755 ${WORKDIR}/checkroot ${D}${sysconfdir}/init.d
43
44         # Remove the do install links (this detects a change to the
45         # initscripts .bb file - it will cause a build failure here.)
46         # This is a copy of the ln -sf lines from the initscripts
47         # do_install.
48         rm      ${D}${sysconfdir}/rc2.d/S99rmnologin
49         rm      ${D}${sysconfdir}/rc3.d/S99rmnologin
50         rm      ${D}${sysconfdir}/rc4.d/S99rmnologin
51         rm      ${D}${sysconfdir}/rc5.d/S99rmnologin
52         rm      ${D}${sysconfdir}/rc6.d/S20sendsigs
53 #       rm      ${D}${sysconfdir}/rc6.d/S30urandom
54         rm      ${D}${sysconfdir}/rc6.d/S31umountnfs.sh
55         rm      ${D}${sysconfdir}/rc6.d/S40umountfs
56         rm      ${D}${sysconfdir}/rcS.d/S30ramdisk
57         rm      ${D}${sysconfdir}/rc6.d/S90reboot
58         rm      ${D}${sysconfdir}/rc0.d/S20sendsigs
59 #       rm      ${D}${sysconfdir}/rc0.d/S30urandom
60         rm      ${D}${sysconfdir}/rc0.d/S31umountnfs.sh
61         rm      ${D}${sysconfdir}/rc0.d/S40umountfs
62         rm      ${D}${sysconfdir}/rc0.d/S90halt
63         rm      ${D}${sysconfdir}/rcS.d/S02banner
64         rm      ${D}${sysconfdir}/rcS.d/S10checkroot
65 #       rm      ${D}${sysconfdir}/rcS.d/S30checkfs.sh
66         rm      ${D}${sysconfdir}/rcS.d/S35mountall.sh
67         rm      ${D}${sysconfdir}/rcS.d/S39hostname.sh
68         rm      ${D}${sysconfdir}/rcS.d/S45mountnfs.sh
69         rm      ${D}${sysconfdir}/rcS.d/S55bootmisc.sh
70 #       rm      ${D}${sysconfdir}/rcS.d/S55urandom
71         rm      ${D}${sysconfdir}/rcS.d/S99finish.sh
72         # udev will run at S04 if installed
73         rm      ${D}${sysconfdir}/rcS.d/S03sysfs
74         rm      ${D}${sysconfdir}/rcS.d/S38devpts.sh
75         rm -f   ${D}${sysconfdir}/rcS.d/S06alignment
76         rm      ${D}${sysconfdir}/rcS.d/S37populate-volatile.sh
77         rm      ${D}${sysconfdir}/rc0.d/S25save-rtc.sh
78         rm      ${D}${sysconfdir}/rc6.d/S25save-rtc.sh
79
80
81
82         # Check the result
83         find ${D}${sysconfdir}/rc?.d ! -type d -print | {
84                 status=0
85                 while read d
86                 do
87                         oenote "initscripts-slugos: unexpected link $d"
88                         status=1
89                 done
90                 test $status -eq 0 ||
91                         oefatal "initscripts-slugos: new links break do_install"
92         }
93
94         # Set the run-level links
95         #
96         # Startup (S) links - UNCHANGED
97         #
98         # Keep these in order of startup - S, then 1, 2-5, 0,6
99         # according to the level in which the script starts (or stops) first.
100         update-rc.d -r ${D} banner              start  2 S .
101         update-rc.d -r ${D} sysfs.sh            start  3 S .
102         # udev runs at S 04 .
103         update-rc.d -r ${D} alignment.sh        start  7 S .
104         # busybox hwclock.sh (slugos-init) starts here (08)
105         # slugos-init umountinitrd runs here (09)
106
107         update-rc.d -r ${D} checkroot           start 10 S .
108         # slugos buffer syslog starts here (11)
109         # sysconfsetup runs at S 12
110         # modutils.sh runs at S 20
111         # checkfs.sh is currently disabled from S 30 (and won't work on SlugOS)
112         # ramdisk is not used on SlugOS, would run at S 30
113         update-rc.d -r ${D} mountall.sh         start 35 S .
114         # bootclean must run after mountall but before populate-volatile
115         update-rc.d -r ${D} bootclean.sh        start 36 S .
116         # base-files populate-volatile.sh runs at S37
117         update-rc.d -r ${D} devpts.sh           start 38 S .
118         # slugos file syslog starts here (39)
119         update-rc.d -r ${D} populate-volatile.sh        start 37 S .
120
121         # set hostname and domainname before the network script works (by
122         # entering them at level 40), networking may reset them.
123         update-rc.d -r ${D} domainname.sh       start 40 S .
124         update-rc.d -r ${D} hostname.sh         start 40 S .
125         # network runs at S 40
126         # slugos network syslog starts here (44)
127         update-rc.d -r ${D} mountnfs.sh         start 45 S .
128
129         update-rc.d -r ${D} bootmisc.sh         start 55 S .
130         # urandom is currently disabled from S 55 (and won't work with tmpfs /var)
131
132         # ipkg-cl configure runs at S 98
133         update-rc.d -r ${D} finish.sh           start 99 S .
134
135         #
136         # User (2-5) links - UNCHANGED
137         # rmnologin is the only thing added to user levels
138         update-rc.d -r ${D} rmnologin           start 99 2 3 4 5 .
139
140         #
141         # Shutdown (0,6) links - !!!CHANGED!!!
142         #
143         # The problem here is that netbase installs K40networking but portmap
144         # installs S32portmap.  One of these has to change!  The safe change
145         # is to make the networking stop at S40, so all network related shutdown
146         # must be in a K script or <S40.
147         #
148         # S20sendsigs is a disaster.  It needs to happen before the umounts
149         # but after the portmapper (which it would otherwise kill).
150         #
151         # urandom would stop at (S)30
152
153         # This is the special, correct, slugos umountnfs.sh (it looks in
154         # the /proc/mounts information, not /etc/fstab)
155         update-rc.d -r ${D} umountnfs.sh        start 31 0 6 .
156         update-rc.d -r ${D} save-rtc.sh         start 25 0 6 .
157         # portmap stops at 32
158         # slugos network syslog stops here (39)
159         # networking stops at 40 (nothing else does, believe me.)
160
161         # busybox hwclock.sh (slugos-init) stops here (45)
162         # slugos file syslog stops here (47)
163         # slugos buffer syslog stops here (49)
164         # udev stops here (55)
165         # Remove any errant processes
166         update-rc.d -r ${D} sendsigs            start 60 0 6 .
167
168         # This is the special, correct, slugos umountfs, it will umount
169         # any network file systems which failed to umount before.
170         update-rc.d -r ${D} umountfs            start 70 0 6 .
171
172         update-rc.d -r ${D} halt                start 90 0 .
173         update-rc.d -r ${D} reboot              start 90 6 .
174 }