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