blob: 5e994f2b7fd0f63c6374a9d38b3612935d848b66 [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"
5LICENSE = "GPLv2"
6LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
7PR = "r155"
8
9INHIBIT_DEFAULT_DEPS = "1"
10
11SRC_URI = "file://functions \
12 file://halt \
13 file://umountfs \
14 file://devpts.sh \
15 file://devpts \
16 file://hostname.sh \
17 file://mountall.sh \
18 file://banner.sh \
19 file://bootmisc.sh \
20 file://mountnfs.sh \
21 file://reboot \
22 file://checkfs.sh \
23 file://single \
24 file://sendsigs \
25 file://urandom \
26 file://rmnologin.sh \
27 file://checkroot.sh \
28 file://umountnfs.sh \
29 file://sysfs.sh \
30 file://populate-volatile.sh \
31 file://read-only-rootfs-hook.sh \
32 file://volatiles \
33 file://save-rtc.sh \
34 file://GPLv2.patch \
35 file://dmesg.sh \
36 file://logrotate-dmesg.conf \
37 ${@bb.utils.contains('DISTRO_FEATURES','selinux','file://sushell','',d)} \
38"
39
40S = "${WORKDIR}"
41
42SRC_URI_append_arm = " file://alignment.sh"
Brad Bishopa34c0302019-09-23 22:34:48 -040043SRC_URI_append_armeb = " file://alignment.sh"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050044
45KERNEL_VERSION = ""
46
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047DEPENDS_append = " update-rc.d-native"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050048PACKAGE_WRITE_DEPS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049
Brad Bishopd7bf8c12018-02-25 22:55:05 -050050PACKAGES =+ "${PN}-functions ${PN}-sushell"
51RDEPENDS_${PN} = "initd-functions \
52 ${@bb.utils.contains('DISTRO_FEATURES','selinux','${PN}-sushell','',d)} \
Andrew Geissler4ed12e12020-06-05 18:00:41 -050053 init-system-helpers-service \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054 "
Brad Bishopd7bf8c12018-02-25 22:55:05 -050055# Recommend pn-functions so that it will be a preferred default provider for initd-functions
56RRECOMMENDS_${PN} = "${PN}-functions"
57RPROVIDES_${PN}-functions = "initd-functions"
58RCONFLICTS_${PN}-functions = "lsbinitscripts"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050059FILES_${PN}-functions = "${sysconfdir}/init.d/functions*"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050060FILES_${PN}-sushell = "${base_sbindir}/sushell"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061
62HALTARGS ?= "-d -f"
63
64do_configure() {
65 sed -i -e "s:SED_HALTARGS:${HALTARGS}:g" ${WORKDIR}/halt
66 sed -i -e "s:SED_HALTARGS:${HALTARGS}:g" ${WORKDIR}/reboot
67}
68
69do_install () {
70#
71# Create directories and install device independent scripts
72#
73 install -d ${D}${sysconfdir}/init.d
74 install -d ${D}${sysconfdir}/rcS.d
75 install -d ${D}${sysconfdir}/rc0.d
76 install -d ${D}${sysconfdir}/rc1.d
77 install -d ${D}${sysconfdir}/rc2.d
78 install -d ${D}${sysconfdir}/rc3.d
79 install -d ${D}${sysconfdir}/rc4.d
80 install -d ${D}${sysconfdir}/rc5.d
81 install -d ${D}${sysconfdir}/rc6.d
82 install -d ${D}${sysconfdir}/default
83 install -d ${D}${sysconfdir}/default/volatiles
84 # Holds state information pertaining to urandom
85 install -d ${D}${localstatedir}/lib/urandom
86
87 install -m 0644 ${WORKDIR}/functions ${D}${sysconfdir}/init.d
88 install -m 0755 ${WORKDIR}/bootmisc.sh ${D}${sysconfdir}/init.d
89 install -m 0755 ${WORKDIR}/checkroot.sh ${D}${sysconfdir}/init.d
90 install -m 0755 ${WORKDIR}/halt ${D}${sysconfdir}/init.d
91 install -m 0755 ${WORKDIR}/hostname.sh ${D}${sysconfdir}/init.d
92 install -m 0755 ${WORKDIR}/mountall.sh ${D}${sysconfdir}/init.d
93 install -m 0755 ${WORKDIR}/mountnfs.sh ${D}${sysconfdir}/init.d
94 install -m 0755 ${WORKDIR}/reboot ${D}${sysconfdir}/init.d
95 install -m 0755 ${WORKDIR}/rmnologin.sh ${D}${sysconfdir}/init.d
96 install -m 0755 ${WORKDIR}/sendsigs ${D}${sysconfdir}/init.d
97 install -m 0755 ${WORKDIR}/single ${D}${sysconfdir}/init.d
98 install -m 0755 ${WORKDIR}/umountnfs.sh ${D}${sysconfdir}/init.d
99 install -m 0755 ${WORKDIR}/urandom ${D}${sysconfdir}/init.d
100 sed -i ${D}${sysconfdir}/init.d/urandom -e 's,/var/,${localstatedir}/,g;s,/etc/,${sysconfdir}/,g'
101 install -m 0755 ${WORKDIR}/devpts.sh ${D}${sysconfdir}/init.d
102 install -m 0755 ${WORKDIR}/devpts ${D}${sysconfdir}/default
103 install -m 0755 ${WORKDIR}/sysfs.sh ${D}${sysconfdir}/init.d
104 install -m 0755 ${WORKDIR}/populate-volatile.sh ${D}${sysconfdir}/init.d
105 install -m 0755 ${WORKDIR}/read-only-rootfs-hook.sh ${D}${sysconfdir}/init.d
106 install -m 0755 ${WORKDIR}/save-rtc.sh ${D}${sysconfdir}/init.d
107 install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/00_core
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500108 if [ ${@ oe.types.boolean('${VOLATILE_LOG_DIR}') } = True ]; then
109 echo "l root root 0755 /var/log /var/volatile/log" >> ${D}${sysconfdir}/default/volatiles/00_core
110 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500111 install -m 0755 ${WORKDIR}/dmesg.sh ${D}${sysconfdir}/init.d
112 install -m 0644 ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
113
114 if [ "${TARGET_ARCH}" = "arm" ]; then
115 install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d
116 fi
117
118 if ${@bb.utils.contains('DISTRO_FEATURES','selinux','true','false',d)}; then
119 install -d ${D}/${base_sbindir}
120 install -m 0755 ${WORKDIR}/sushell ${D}/${base_sbindir}
121 fi
122#
123# Install device dependent scripts
124#
125 install -m 0755 ${WORKDIR}/banner.sh ${D}${sysconfdir}/init.d/banner.sh
126 install -m 0755 ${WORKDIR}/umountfs ${D}${sysconfdir}/init.d/umountfs
127#
128# Create runlevel links
129#
130 update-rc.d -r ${D} rmnologin.sh start 99 2 3 4 5 .
131 update-rc.d -r ${D} sendsigs start 20 0 6 .
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500132 update-rc.d -r ${D} urandom start 38 S 0 6 .
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500133 update-rc.d -r ${D} umountnfs.sh start 31 0 1 6 .
134 update-rc.d -r ${D} umountfs start 40 0 6 .
135 update-rc.d -r ${D} reboot start 90 6 .
136 update-rc.d -r ${D} halt start 90 0 .
137 update-rc.d -r ${D} save-rtc.sh start 25 0 6 .
138 update-rc.d -r ${D} banner.sh start 02 S .
Andrew Geissler09209ee2020-12-13 08:44:15 -0600139 update-rc.d -r ${D} checkroot.sh start 05 S .
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500140 update-rc.d -r ${D} mountall.sh start 03 S .
141 update-rc.d -r ${D} hostname.sh start 39 S .
142 update-rc.d -r ${D} mountnfs.sh start 15 2 3 4 5 .
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500143 update-rc.d -r ${D} bootmisc.sh start 36 S .
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500144 update-rc.d -r ${D} sysfs.sh start 02 S .
145 update-rc.d -r ${D} populate-volatile.sh start 37 S .
146 update-rc.d -r ${D} read-only-rootfs-hook.sh start 29 S .
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600147 update-rc.d -r ${D} devpts.sh start 06 S .
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500148 if [ "${TARGET_ARCH}" = "arm" ]; then
149 update-rc.d -r ${D} alignment.sh start 06 S .
150 fi
151 # We wish to have /var/log ready at this stage so execute this after
152 # populate-volatile.sh
153 update-rc.d -r ${D} dmesg.sh start 38 S .
154}
155
156MASKED_SCRIPTS = " \
157 banner \
158 bootmisc \
159 checkfs \
160 checkroot \
161 devpts \
162 dmesg \
163 hostname \
164 mountall \
165 mountnfs \
166 populate-volatile \
167 read-only-rootfs-hook \
168 rmnologin \
169 sysfs \
170 urandom"
171
172pkg_postinst_${PN} () {
Andrew Geissler475cb722020-07-10 16:00:51 -0500173 if type systemctl >/dev/null 2>/dev/null; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500174 if [ -n "$D" ]; then
175 OPTS="--root=$D"
176 fi
177 for SERVICE in ${MASKED_SCRIPTS}; do
178 systemctl $OPTS mask $SERVICE.service
179 done
180 fi
181
182 # Delete any old volatile cache script, as directories may have moved
183 if [ -z "$D" ]; then
184 rm -f "/etc/volatile.cache"
185 fi
186}
187
188CONFFILES_${PN} += "${sysconfdir}/init.d/checkroot.sh"