blob: 8f110b0050f2059764d5f28bdc38264f9544a0c8 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "SysV init scripts"
2DESCRIPTION = "Initscripts provide the basic system startup initialization scripts for the system. These scripts include actions such as filesystem mounting, fsck, RTC manipulation and other actions routinely performed at system startup. In addition, the scripts are also used during system shutdown to reverse the actions performed at startup."
3SECTION = "base"
4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
6PR = "r155"
7
8INHIBIT_DEFAULT_DEPS = "1"
9
10SRC_URI = "file://functions \
11 file://halt \
12 file://umountfs \
13 file://devpts.sh \
14 file://devpts \
15 file://hostname.sh \
16 file://mountall.sh \
17 file://banner.sh \
18 file://bootmisc.sh \
19 file://mountnfs.sh \
20 file://reboot \
21 file://checkfs.sh \
22 file://single \
23 file://sendsigs \
24 file://urandom \
25 file://rmnologin.sh \
26 file://checkroot.sh \
27 file://umountnfs.sh \
28 file://sysfs.sh \
29 file://populate-volatile.sh \
30 file://read-only-rootfs-hook.sh \
31 file://volatiles \
32 file://save-rtc.sh \
33 file://GPLv2.patch \
34 file://dmesg.sh \
35 file://logrotate-dmesg.conf \
36 ${@bb.utils.contains('DISTRO_FEATURES','selinux','file://sushell','',d)} \
37"
38
39S = "${WORKDIR}"
40
41SRC_URI_append_arm = " file://alignment.sh"
42
43KERNEL_VERSION = ""
44
45inherit update-alternatives
46DEPENDS_append = " update-rc.d-native"
47DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
48
49PACKAGES =+ "${PN}-functions"
50RDEPENDS_${PN} = "${PN}-functions \
51 ${@bb.utils.contains('DISTRO_FEATURES','selinux','bash','',d)} \
52 "
53FILES_${PN}-functions = "${sysconfdir}/init.d/functions*"
54
55ALTERNATIVE_PRIORITY_${PN}-functions = "90"
56ALTERNATIVE_${PN}-functions = "functions"
57ALTERNATIVE_LINK_NAME[functions] = "${sysconfdir}/init.d/functions"
58
59HALTARGS ?= "-d -f"
60
61do_configure() {
62 sed -i -e "s:SED_HALTARGS:${HALTARGS}:g" ${WORKDIR}/halt
63 sed -i -e "s:SED_HALTARGS:${HALTARGS}:g" ${WORKDIR}/reboot
64}
65
66do_install () {
67#
68# Create directories and install device independent scripts
69#
70 install -d ${D}${sysconfdir}/init.d
71 install -d ${D}${sysconfdir}/rcS.d
72 install -d ${D}${sysconfdir}/rc0.d
73 install -d ${D}${sysconfdir}/rc1.d
74 install -d ${D}${sysconfdir}/rc2.d
75 install -d ${D}${sysconfdir}/rc3.d
76 install -d ${D}${sysconfdir}/rc4.d
77 install -d ${D}${sysconfdir}/rc5.d
78 install -d ${D}${sysconfdir}/rc6.d
79 install -d ${D}${sysconfdir}/default
80 install -d ${D}${sysconfdir}/default/volatiles
81 # Holds state information pertaining to urandom
82 install -d ${D}${localstatedir}/lib/urandom
83
84 install -m 0644 ${WORKDIR}/functions ${D}${sysconfdir}/init.d
85 install -m 0755 ${WORKDIR}/bootmisc.sh ${D}${sysconfdir}/init.d
86 install -m 0755 ${WORKDIR}/checkroot.sh ${D}${sysconfdir}/init.d
87 install -m 0755 ${WORKDIR}/halt ${D}${sysconfdir}/init.d
88 install -m 0755 ${WORKDIR}/hostname.sh ${D}${sysconfdir}/init.d
89 install -m 0755 ${WORKDIR}/mountall.sh ${D}${sysconfdir}/init.d
90 install -m 0755 ${WORKDIR}/mountnfs.sh ${D}${sysconfdir}/init.d
91 install -m 0755 ${WORKDIR}/reboot ${D}${sysconfdir}/init.d
92 install -m 0755 ${WORKDIR}/rmnologin.sh ${D}${sysconfdir}/init.d
93 install -m 0755 ${WORKDIR}/sendsigs ${D}${sysconfdir}/init.d
94 install -m 0755 ${WORKDIR}/single ${D}${sysconfdir}/init.d
95 install -m 0755 ${WORKDIR}/umountnfs.sh ${D}${sysconfdir}/init.d
96 install -m 0755 ${WORKDIR}/urandom ${D}${sysconfdir}/init.d
97 sed -i ${D}${sysconfdir}/init.d/urandom -e 's,/var/,${localstatedir}/,g;s,/etc/,${sysconfdir}/,g'
98 install -m 0755 ${WORKDIR}/devpts.sh ${D}${sysconfdir}/init.d
99 install -m 0755 ${WORKDIR}/devpts ${D}${sysconfdir}/default
100 install -m 0755 ${WORKDIR}/sysfs.sh ${D}${sysconfdir}/init.d
101 install -m 0755 ${WORKDIR}/populate-volatile.sh ${D}${sysconfdir}/init.d
102 install -m 0755 ${WORKDIR}/read-only-rootfs-hook.sh ${D}${sysconfdir}/init.d
103 install -m 0755 ${WORKDIR}/save-rtc.sh ${D}${sysconfdir}/init.d
104 install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/00_core
105 install -m 0755 ${WORKDIR}/dmesg.sh ${D}${sysconfdir}/init.d
106 install -m 0644 ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
107
108 if [ "${TARGET_ARCH}" = "arm" ]; then
109 install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d
110 fi
111
112 if ${@bb.utils.contains('DISTRO_FEATURES','selinux','true','false',d)}; then
113 install -d ${D}/${base_sbindir}
114 install -m 0755 ${WORKDIR}/sushell ${D}/${base_sbindir}
115 fi
116#
117# Install device dependent scripts
118#
119 install -m 0755 ${WORKDIR}/banner.sh ${D}${sysconfdir}/init.d/banner.sh
120 install -m 0755 ${WORKDIR}/umountfs ${D}${sysconfdir}/init.d/umountfs
121#
122# Create runlevel links
123#
124 update-rc.d -r ${D} rmnologin.sh start 99 2 3 4 5 .
125 update-rc.d -r ${D} sendsigs start 20 0 6 .
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500126 update-rc.d -r ${D} urandom start 38 S 0 6 .
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500127 update-rc.d -r ${D} umountnfs.sh start 31 0 1 6 .
128 update-rc.d -r ${D} umountfs start 40 0 6 .
129 update-rc.d -r ${D} reboot start 90 6 .
130 update-rc.d -r ${D} halt start 90 0 .
131 update-rc.d -r ${D} save-rtc.sh start 25 0 6 .
132 update-rc.d -r ${D} banner.sh start 02 S .
133 update-rc.d -r ${D} checkroot.sh start 06 S .
134 update-rc.d -r ${D} mountall.sh start 03 S .
135 update-rc.d -r ${D} hostname.sh start 39 S .
136 update-rc.d -r ${D} mountnfs.sh start 15 2 3 4 5 .
137 update-rc.d -r ${D} bootmisc.sh start 55 S .
138 update-rc.d -r ${D} sysfs.sh start 02 S .
139 update-rc.d -r ${D} populate-volatile.sh start 37 S .
140 update-rc.d -r ${D} read-only-rootfs-hook.sh start 29 S .
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600141 update-rc.d -r ${D} devpts.sh start 06 S .
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500142 if [ "${TARGET_ARCH}" = "arm" ]; then
143 update-rc.d -r ${D} alignment.sh start 06 S .
144 fi
145 # We wish to have /var/log ready at this stage so execute this after
146 # populate-volatile.sh
147 update-rc.d -r ${D} dmesg.sh start 38 S .
148}
149
150MASKED_SCRIPTS = " \
151 banner \
152 bootmisc \
153 checkfs \
154 checkroot \
155 devpts \
156 dmesg \
157 hostname \
158 mountall \
159 mountnfs \
160 populate-volatile \
161 read-only-rootfs-hook \
162 rmnologin \
163 sysfs \
164 urandom"
165
166pkg_postinst_${PN} () {
167 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
168 if [ -n "$D" ]; then
169 OPTS="--root=$D"
170 fi
171 for SERVICE in ${MASKED_SCRIPTS}; do
172 systemctl $OPTS mask $SERVICE.service
173 done
174 fi
175
176 # Delete any old volatile cache script, as directories may have moved
177 if [ -z "$D" ]; then
178 rm -f "/etc/volatile.cache"
179 fi
180}
181
182CONFFILES_${PN} += "${sysconfdir}/init.d/checkroot.sh"