blob: 4b34c6a67ff88a63d5f4d769dda5f430749ec427 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "SysV init scripts"
Brad Bishopd7bf8c12018-02-25 22:55:05 -05002HOMEPAGE = "https://github.com/fedora-sysv/initscripts"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05003DESCRIPTION = "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."
4SECTION = "base"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00005LICENSE = "GPL-2.0-only"
Patrick Williams45852732022-04-02 08:58:32 -05006LIC_FILES_CHKSUM = "file://functions;beginline=7;endline=7;md5=829e563511c9a1d6d41f17a7a4989d6a"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007
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 \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050033 file://dmesg.sh \
34 file://logrotate-dmesg.conf \
35 ${@bb.utils.contains('DISTRO_FEATURES','selinux','file://sushell','',d)} \
36"
37
38S = "${WORKDIR}"
39
Patrick Williams213cb262021-08-07 19:21:33 -050040SRC_URI:append:arm = " file://alignment.sh"
41SRC_URI:append:armeb = " file://alignment.sh"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042
43KERNEL_VERSION = ""
44
Patrick Williams213cb262021-08-07 19:21:33 -050045DEPENDS:append = " update-rc.d-native"
46PACKAGE_WRITE_DEPS:append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047
Brad Bishopd7bf8c12018-02-25 22:55:05 -050048PACKAGES =+ "${PN}-functions ${PN}-sushell"
Patrick Williams213cb262021-08-07 19:21:33 -050049RDEPENDS:${PN} = "initd-functions \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050050 ${@bb.utils.contains('DISTRO_FEATURES','selinux','${PN}-sushell','',d)} \
Andrew Geissler4ed12e12020-06-05 18:00:41 -050051 init-system-helpers-service \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052 "
Brad Bishopd7bf8c12018-02-25 22:55:05 -050053# Recommend pn-functions so that it will be a preferred default provider for initd-functions
Patrick Williams213cb262021-08-07 19:21:33 -050054RRECOMMENDS:${PN} = "${PN}-functions"
55RPROVIDES:${PN}-functions = "initd-functions"
56RCONFLICTS:${PN}-functions = "lsbinitscripts"
57FILES:${PN}-functions = "${sysconfdir}/init.d/functions*"
58FILES:${PN}-sushell = "${base_sbindir}/sushell"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050059
60HALTARGS ?= "-d -f"
61
62do_configure() {
63 sed -i -e "s:SED_HALTARGS:${HALTARGS}:g" ${WORKDIR}/halt
64 sed -i -e "s:SED_HALTARGS:${HALTARGS}:g" ${WORKDIR}/reboot
65}
66
67do_install () {
68#
69# Create directories and install device independent scripts
70#
71 install -d ${D}${sysconfdir}/init.d
72 install -d ${D}${sysconfdir}/rcS.d
73 install -d ${D}${sysconfdir}/rc0.d
74 install -d ${D}${sysconfdir}/rc1.d
75 install -d ${D}${sysconfdir}/rc2.d
76 install -d ${D}${sysconfdir}/rc3.d
77 install -d ${D}${sysconfdir}/rc4.d
78 install -d ${D}${sysconfdir}/rc5.d
79 install -d ${D}${sysconfdir}/rc6.d
80 install -d ${D}${sysconfdir}/default
81 install -d ${D}${sysconfdir}/default/volatiles
82 # Holds state information pertaining to urandom
83 install -d ${D}${localstatedir}/lib/urandom
84
85 install -m 0644 ${WORKDIR}/functions ${D}${sysconfdir}/init.d
86 install -m 0755 ${WORKDIR}/bootmisc.sh ${D}${sysconfdir}/init.d
87 install -m 0755 ${WORKDIR}/checkroot.sh ${D}${sysconfdir}/init.d
88 install -m 0755 ${WORKDIR}/halt ${D}${sysconfdir}/init.d
89 install -m 0755 ${WORKDIR}/hostname.sh ${D}${sysconfdir}/init.d
90 install -m 0755 ${WORKDIR}/mountall.sh ${D}${sysconfdir}/init.d
91 install -m 0755 ${WORKDIR}/mountnfs.sh ${D}${sysconfdir}/init.d
92 install -m 0755 ${WORKDIR}/reboot ${D}${sysconfdir}/init.d
93 install -m 0755 ${WORKDIR}/rmnologin.sh ${D}${sysconfdir}/init.d
94 install -m 0755 ${WORKDIR}/sendsigs ${D}${sysconfdir}/init.d
95 install -m 0755 ${WORKDIR}/single ${D}${sysconfdir}/init.d
96 install -m 0755 ${WORKDIR}/umountnfs.sh ${D}${sysconfdir}/init.d
97 install -m 0755 ${WORKDIR}/urandom ${D}${sysconfdir}/init.d
98 sed -i ${D}${sysconfdir}/init.d/urandom -e 's,/var/,${localstatedir}/,g;s,/etc/,${sysconfdir}/,g'
99 install -m 0755 ${WORKDIR}/devpts.sh ${D}${sysconfdir}/init.d
100 install -m 0755 ${WORKDIR}/devpts ${D}${sysconfdir}/default
101 install -m 0755 ${WORKDIR}/sysfs.sh ${D}${sysconfdir}/init.d
102 install -m 0755 ${WORKDIR}/populate-volatile.sh ${D}${sysconfdir}/init.d
103 install -m 0755 ${WORKDIR}/read-only-rootfs-hook.sh ${D}${sysconfdir}/init.d
104 install -m 0755 ${WORKDIR}/save-rtc.sh ${D}${sysconfdir}/init.d
105 install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/00_core
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500106 if [ ${@ oe.types.boolean('${VOLATILE_LOG_DIR}') } = True ]; then
Patrick Williams213cb262021-08-07 19:21:33 -0500107 sed -i -e '\@^d root root 0755 /var/volatile/log none$@ a\l root root 0755 /var/log /var/volatile/log' \
108 ${D}${sysconfdir}/default/volatiles/00_core
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500109 fi
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600110 if [ "${VOLATILE_TMP_DIR}" != "yes" ]; then
111 sed -i -e "/\<tmp\>/d" ${D}${sysconfdir}/default/volatiles/00_core
112 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500113 install -m 0755 ${WORKDIR}/dmesg.sh ${D}${sysconfdir}/init.d
114 install -m 0644 ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
115
116 if [ "${TARGET_ARCH}" = "arm" ]; then
117 install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d
118 fi
119
120 if ${@bb.utils.contains('DISTRO_FEATURES','selinux','true','false',d)}; then
121 install -d ${D}/${base_sbindir}
122 install -m 0755 ${WORKDIR}/sushell ${D}/${base_sbindir}
123 fi
124#
125# Install device dependent scripts
126#
127 install -m 0755 ${WORKDIR}/banner.sh ${D}${sysconfdir}/init.d/banner.sh
128 install -m 0755 ${WORKDIR}/umountfs ${D}${sysconfdir}/init.d/umountfs
129#
130# Create runlevel links
131#
132 update-rc.d -r ${D} rmnologin.sh start 99 2 3 4 5 .
133 update-rc.d -r ${D} sendsigs start 20 0 6 .
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500134 update-rc.d -r ${D} urandom start 38 S 0 6 .
Patrick Williamsdb4c27e2022-08-05 08:10:29 -0500135 update-rc.d -r ${D} umountnfs.sh stop 31 0 1 6 .
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500136 update-rc.d -r ${D} umountfs start 40 0 6 .
137 update-rc.d -r ${D} reboot start 90 6 .
138 update-rc.d -r ${D} halt start 90 0 .
139 update-rc.d -r ${D} save-rtc.sh start 25 0 6 .
140 update-rc.d -r ${D} banner.sh start 02 S .
Andrew Geissler09209ee2020-12-13 08:44:15 -0600141 update-rc.d -r ${D} checkroot.sh start 05 S .
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500142 update-rc.d -r ${D} mountall.sh start 03 S .
143 update-rc.d -r ${D} hostname.sh start 39 S .
144 update-rc.d -r ${D} mountnfs.sh start 15 2 3 4 5 .
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500145 update-rc.d -r ${D} bootmisc.sh start 36 S .
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500146 update-rc.d -r ${D} sysfs.sh start 02 S .
147 update-rc.d -r ${D} populate-volatile.sh start 37 S .
148 update-rc.d -r ${D} read-only-rootfs-hook.sh start 29 S .
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600149 update-rc.d -r ${D} devpts.sh start 06 S .
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500150 if [ "${TARGET_ARCH}" = "arm" ]; then
151 update-rc.d -r ${D} alignment.sh start 06 S .
152 fi
153 # We wish to have /var/log ready at this stage so execute this after
154 # populate-volatile.sh
155 update-rc.d -r ${D} dmesg.sh start 38 S .
156}
157
158MASKED_SCRIPTS = " \
159 banner \
160 bootmisc \
161 checkfs \
162 checkroot \
163 devpts \
164 dmesg \
165 hostname \
166 mountall \
167 mountnfs \
168 populate-volatile \
169 read-only-rootfs-hook \
170 rmnologin \
171 sysfs \
172 urandom"
173
Patrick Williams213cb262021-08-07 19:21:33 -0500174pkg_postinst:${PN} () {
Andrew Geissler475cb722020-07-10 16:00:51 -0500175 if type systemctl >/dev/null 2>/dev/null; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500176 if [ -n "$D" ]; then
177 OPTS="--root=$D"
178 fi
179 for SERVICE in ${MASKED_SCRIPTS}; do
180 systemctl $OPTS mask $SERVICE.service
181 done
182 fi
183
184 # Delete any old volatile cache script, as directories may have moved
185 if [ -z "$D" ]; then
186 rm -f "/etc/volatile.cache"
187 fi
188}
189
Patrick Williams213cb262021-08-07 19:21:33 -0500190CONFFILES:${PN} += "${sysconfdir}/init.d/checkroot.sh"