initscripts_1.0.bb 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. SUMMARY = "SysV init scripts"
  2. HOMEPAGE = "https://github.com/fedora-sysv/initscripts"
  3. DESCRIPTION = "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."
  4. SECTION = "base"
  5. LICENSE = "GPL-2.0-only"
  6. LIC_FILES_CHKSUM = "file://functions;beginline=7;endline=7;md5=829e563511c9a1d6d41f17a7a4989d6a"
  7. INHIBIT_DEFAULT_DEPS = "1"
  8. SRC_URI = "file://functions \
  9. file://halt \
  10. file://umountfs \
  11. file://devpts.sh \
  12. file://devpts \
  13. file://hostname.sh \
  14. file://mountall.sh \
  15. file://banner.sh \
  16. file://bootmisc.sh \
  17. file://mountnfs.sh \
  18. file://reboot \
  19. file://checkfs.sh \
  20. file://single \
  21. file://sendsigs \
  22. file://urandom \
  23. file://rmnologin.sh \
  24. file://checkroot.sh \
  25. file://umountnfs.sh \
  26. file://sysfs.sh \
  27. file://populate-volatile.sh \
  28. file://read-only-rootfs-hook.sh \
  29. file://volatiles \
  30. file://save-rtc.sh \
  31. file://dmesg.sh \
  32. file://logrotate-dmesg.conf \
  33. ${@bb.utils.contains('DISTRO_FEATURES','selinux','file://sushell','',d)} \
  34. "
  35. S = "${WORKDIR}/sources"
  36. UNPACKDIR = "${S}"
  37. SRC_URI:append:arm = " file://alignment.sh"
  38. SRC_URI:append:armeb = " file://alignment.sh"
  39. KERNEL_VERSION = ""
  40. DEPENDS:append = " update-rc.d-native"
  41. PACKAGE_WRITE_DEPS:append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
  42. PACKAGES =+ "${PN}-functions ${PN}-sushell"
  43. RDEPENDS:${PN} = "initd-functions \
  44. ${@bb.utils.contains('DISTRO_FEATURES','selinux','${PN}-sushell','',d)} \
  45. init-system-helpers-service \
  46. "
  47. # Recommend pn-functions so that it will be a preferred default provider for initd-functions
  48. RRECOMMENDS:${PN} = "${PN}-functions"
  49. RPROVIDES:${PN}-functions = "initd-functions"
  50. RCONFLICTS:${PN}-functions = "lsbinitscripts"
  51. FILES:${PN}-functions = "${sysconfdir}/init.d/functions*"
  52. FILES:${PN}-sushell = "${base_sbindir}/sushell"
  53. HALTARGS ?= "-d -f"
  54. VARLIBMOUNTARGS ?= ""
  55. do_configure() {
  56. sed -i -e "s:SED_HALTARGS:${HALTARGS}:g" ${S}/halt
  57. sed -i -e "s:SED_HALTARGS:${HALTARGS}:g" ${S}/reboot
  58. sed -i -e "s:SED_VARLIBMOUNTARGS:${VARLIBMOUNTARGS}:g" ${S}/read-only-rootfs-hook.sh
  59. }
  60. do_install () {
  61. #
  62. # Create directories and install device independent scripts
  63. #
  64. install -d ${D}${sysconfdir}/init.d
  65. install -d ${D}${sysconfdir}/rcS.d
  66. install -d ${D}${sysconfdir}/rc0.d
  67. install -d ${D}${sysconfdir}/rc1.d
  68. install -d ${D}${sysconfdir}/rc2.d
  69. install -d ${D}${sysconfdir}/rc3.d
  70. install -d ${D}${sysconfdir}/rc4.d
  71. install -d ${D}${sysconfdir}/rc5.d
  72. install -d ${D}${sysconfdir}/rc6.d
  73. install -d ${D}${sysconfdir}/default
  74. install -d ${D}${sysconfdir}/default/volatiles
  75. # Holds state information pertaining to urandom
  76. install -d ${D}${localstatedir}/lib/urandom
  77. install -m 0644 ${S}/functions ${D}${sysconfdir}/init.d
  78. install -m 0755 ${S}/bootmisc.sh ${D}${sysconfdir}/init.d
  79. install -m 0755 ${S}/checkroot.sh ${D}${sysconfdir}/init.d
  80. install -m 0755 ${S}/halt ${D}${sysconfdir}/init.d
  81. install -m 0755 ${S}/hostname.sh ${D}${sysconfdir}/init.d
  82. install -m 0755 ${S}/mountall.sh ${D}${sysconfdir}/init.d
  83. install -m 0755 ${S}/mountnfs.sh ${D}${sysconfdir}/init.d
  84. install -m 0755 ${S}/reboot ${D}${sysconfdir}/init.d
  85. install -m 0755 ${S}/rmnologin.sh ${D}${sysconfdir}/init.d
  86. install -m 0755 ${S}/sendsigs ${D}${sysconfdir}/init.d
  87. install -m 0755 ${S}/single ${D}${sysconfdir}/init.d
  88. install -m 0755 ${S}/umountnfs.sh ${D}${sysconfdir}/init.d
  89. install -m 0755 ${S}/urandom ${D}${sysconfdir}/init.d
  90. sed -i ${D}${sysconfdir}/init.d/urandom -e 's,/var/,${localstatedir}/,g;s,/etc/,${sysconfdir}/,g'
  91. install -m 0755 ${S}/devpts.sh ${D}${sysconfdir}/init.d
  92. install -m 0755 ${S}/devpts ${D}${sysconfdir}/default
  93. install -m 0755 ${S}/sysfs.sh ${D}${sysconfdir}/init.d
  94. install -m 0755 ${S}/populate-volatile.sh ${D}${sysconfdir}/init.d
  95. install -m 0755 ${S}/read-only-rootfs-hook.sh ${D}${sysconfdir}/init.d
  96. install -m 0755 ${S}/save-rtc.sh ${D}${sysconfdir}/init.d
  97. install -m 0644 ${S}/volatiles ${D}${sysconfdir}/default/volatiles/00_core
  98. if [ ${@ oe.types.boolean('${VOLATILE_LOG_DIR}') } = True ]; then
  99. sed -i -e '\@^d root root 0755 /var/volatile/log none$@ a\l root root 0755 /var/log /var/volatile/log' \
  100. ${D}${sysconfdir}/default/volatiles/00_core
  101. fi
  102. if [ "${VOLATILE_TMP_DIR}" != "yes" ]; then
  103. sed -i -e "/\<tmp\>/d" ${D}${sysconfdir}/default/volatiles/00_core
  104. fi
  105. install -m 0755 ${S}/dmesg.sh ${D}${sysconfdir}/init.d
  106. install -m 0644 ${S}/logrotate-dmesg.conf ${D}${sysconfdir}/
  107. if [ "${TARGET_ARCH}" = "arm" ]; then
  108. install -m 0755 ${S}/alignment.sh ${D}${sysconfdir}/init.d
  109. fi
  110. if ${@bb.utils.contains('DISTRO_FEATURES','selinux','true','false',d)}; then
  111. install -d ${D}/${base_sbindir}
  112. install -m 0755 ${S}/sushell ${D}/${base_sbindir}
  113. fi
  114. #
  115. # Install device dependent scripts
  116. #
  117. install -m 0755 ${S}/banner.sh ${D}${sysconfdir}/init.d/banner.sh
  118. install -m 0755 ${S}/umountfs ${D}${sysconfdir}/init.d/umountfs
  119. #
  120. # Create runlevel links
  121. #
  122. update-rc.d -r ${D} rmnologin.sh start 99 2 3 4 5 .
  123. update-rc.d -r ${D} sendsigs start 20 0 6 .
  124. update-rc.d -r ${D} urandom start 38 S 0 6 .
  125. update-rc.d -r ${D} umountnfs.sh stop 31 0 1 6 .
  126. update-rc.d -r ${D} umountfs start 40 0 6 .
  127. update-rc.d -r ${D} reboot start 90 6 .
  128. update-rc.d -r ${D} halt start 90 0 .
  129. update-rc.d -r ${D} save-rtc.sh start 25 0 6 .
  130. update-rc.d -r ${D} banner.sh start 02 S .
  131. update-rc.d -r ${D} checkroot.sh start 05 S .
  132. update-rc.d -r ${D} mountall.sh start 03 S .
  133. update-rc.d -r ${D} hostname.sh start 39 S .
  134. update-rc.d -r ${D} mountnfs.sh start 15 2 3 4 5 .
  135. update-rc.d -r ${D} bootmisc.sh start 36 S .
  136. update-rc.d -r ${D} sysfs.sh start 02 S .
  137. update-rc.d -r ${D} populate-volatile.sh start 37 S .
  138. update-rc.d -r ${D} read-only-rootfs-hook.sh start 29 S .
  139. update-rc.d -r ${D} devpts.sh start 06 S .
  140. if [ "${TARGET_ARCH}" = "arm" ]; then
  141. update-rc.d -r ${D} alignment.sh start 06 S .
  142. fi
  143. # We wish to have /var/log ready at this stage so execute this after
  144. # populate-volatile.sh
  145. update-rc.d -r ${D} dmesg.sh start 38 S .
  146. }
  147. MASKED_SCRIPTS = " \
  148. banner \
  149. bootmisc \
  150. checkfs \
  151. checkroot \
  152. devpts \
  153. dmesg \
  154. hostname \
  155. mountall \
  156. mountnfs \
  157. populate-volatile \
  158. read-only-rootfs-hook \
  159. rmnologin \
  160. sysfs \
  161. urandom"
  162. pkg_postinst:${PN} () {
  163. if type systemctl >/dev/null 2>/dev/null; then
  164. if [ -n "$D" ]; then
  165. OPTS="--root=$D"
  166. fi
  167. for SERVICE in ${MASKED_SCRIPTS}; do
  168. systemctl $OPTS mask $SERVICE.service
  169. done
  170. fi
  171. # Delete any old volatile cache script, as directories may have moved
  172. if [ -z "$D" ]; then
  173. rm -f "/etc/volatile.cache"
  174. fi
  175. }
  176. CONFFILES:${PN} += "${sysconfdir}/init.d/checkroot.sh"