initscripts_1.0.bb 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. SUMMARY = "SysV init scripts"
  2. 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."
  3. SECTION = "base"
  4. LICENSE = "GPLv2"
  5. LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
  6. PR = "r155"
  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://GPLv2.patch \
  32. file://dmesg.sh \
  33. file://logrotate-dmesg.conf \
  34. "
  35. S = "${WORKDIR}"
  36. SRC_URI_append_arm = " file://alignment.sh"
  37. KERNEL_VERSION = ""
  38. inherit update-alternatives
  39. DEPENDS_append = " update-rc.d-native"
  40. DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
  41. PACKAGES =+ "${PN}-functions"
  42. RDEPENDS_${PN} = "${PN}-functions"
  43. FILES_${PN}-functions = "${sysconfdir}/init.d/functions*"
  44. ALTERNATIVE_PRIORITY_${PN}-functions = "90"
  45. ALTERNATIVE_${PN}-functions = "functions"
  46. ALTERNATIVE_LINK_NAME[functions] = "${sysconfdir}/init.d/functions"
  47. HALTARGS ?= "-d -f"
  48. do_configure() {
  49. sed -i -e "s:SED_HALTARGS:${HALTARGS}:g" ${WORKDIR}/halt
  50. sed -i -e "s:SED_HALTARGS:${HALTARGS}:g" ${WORKDIR}/reboot
  51. }
  52. do_install () {
  53. #
  54. # Create directories and install device independent scripts
  55. #
  56. install -d ${D}${sysconfdir}/init.d
  57. install -d ${D}${sysconfdir}/rcS.d
  58. install -d ${D}${sysconfdir}/rc0.d
  59. install -d ${D}${sysconfdir}/rc1.d
  60. install -d ${D}${sysconfdir}/rc2.d
  61. install -d ${D}${sysconfdir}/rc3.d
  62. install -d ${D}${sysconfdir}/rc4.d
  63. install -d ${D}${sysconfdir}/rc5.d
  64. install -d ${D}${sysconfdir}/rc6.d
  65. install -d ${D}${sysconfdir}/default
  66. install -d ${D}${sysconfdir}/default/volatiles
  67. # Holds state information pertaining to urandom
  68. install -d ${D}/var/lib/urandom
  69. install -m 0644 ${WORKDIR}/functions ${D}${sysconfdir}/init.d
  70. install -m 0755 ${WORKDIR}/bootmisc.sh ${D}${sysconfdir}/init.d
  71. install -m 0755 ${WORKDIR}/checkroot.sh ${D}${sysconfdir}/init.d
  72. install -m 0755 ${WORKDIR}/halt ${D}${sysconfdir}/init.d
  73. install -m 0755 ${WORKDIR}/hostname.sh ${D}${sysconfdir}/init.d
  74. install -m 0755 ${WORKDIR}/mountall.sh ${D}${sysconfdir}/init.d
  75. install -m 0755 ${WORKDIR}/mountnfs.sh ${D}${sysconfdir}/init.d
  76. install -m 0755 ${WORKDIR}/reboot ${D}${sysconfdir}/init.d
  77. install -m 0755 ${WORKDIR}/rmnologin.sh ${D}${sysconfdir}/init.d
  78. install -m 0755 ${WORKDIR}/sendsigs ${D}${sysconfdir}/init.d
  79. install -m 0755 ${WORKDIR}/single ${D}${sysconfdir}/init.d
  80. install -m 0755 ${WORKDIR}/umountnfs.sh ${D}${sysconfdir}/init.d
  81. install -m 0755 ${WORKDIR}/urandom ${D}${sysconfdir}/init.d
  82. install -m 0755 ${WORKDIR}/devpts.sh ${D}${sysconfdir}/init.d
  83. install -m 0755 ${WORKDIR}/devpts ${D}${sysconfdir}/default
  84. install -m 0755 ${WORKDIR}/sysfs.sh ${D}${sysconfdir}/init.d
  85. install -m 0755 ${WORKDIR}/populate-volatile.sh ${D}${sysconfdir}/init.d
  86. install -m 0755 ${WORKDIR}/read-only-rootfs-hook.sh ${D}${sysconfdir}/init.d
  87. install -m 0755 ${WORKDIR}/save-rtc.sh ${D}${sysconfdir}/init.d
  88. install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/00_core
  89. install -m 0755 ${WORKDIR}/dmesg.sh ${D}${sysconfdir}/init.d
  90. install -m 0644 ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
  91. if [ "${TARGET_ARCH}" = "arm" ]; then
  92. install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d
  93. fi
  94. #
  95. # Install device dependent scripts
  96. #
  97. install -m 0755 ${WORKDIR}/banner.sh ${D}${sysconfdir}/init.d/banner.sh
  98. install -m 0755 ${WORKDIR}/umountfs ${D}${sysconfdir}/init.d/umountfs
  99. #
  100. # Create runlevel links
  101. #
  102. update-rc.d -r ${D} rmnologin.sh start 99 2 3 4 5 .
  103. update-rc.d -r ${D} sendsigs start 20 0 6 .
  104. update-rc.d -r ${D} urandom start 30 S 0 6 .
  105. update-rc.d -r ${D} umountnfs.sh start 31 0 1 6 .
  106. update-rc.d -r ${D} umountfs start 40 0 6 .
  107. update-rc.d -r ${D} reboot start 90 6 .
  108. update-rc.d -r ${D} halt start 90 0 .
  109. update-rc.d -r ${D} save-rtc.sh start 25 0 6 .
  110. update-rc.d -r ${D} banner.sh start 02 S .
  111. update-rc.d -r ${D} checkroot.sh start 06 S .
  112. update-rc.d -r ${D} mountall.sh start 03 S .
  113. update-rc.d -r ${D} hostname.sh start 39 S .
  114. update-rc.d -r ${D} mountnfs.sh start 15 2 3 4 5 .
  115. update-rc.d -r ${D} bootmisc.sh start 55 S .
  116. update-rc.d -r ${D} sysfs.sh start 02 S .
  117. update-rc.d -r ${D} populate-volatile.sh start 37 S .
  118. update-rc.d -r ${D} read-only-rootfs-hook.sh start 29 S .
  119. update-rc.d -r ${D} devpts.sh start 38 S .
  120. if [ "${TARGET_ARCH}" = "arm" ]; then
  121. update-rc.d -r ${D} alignment.sh start 06 S .
  122. fi
  123. # We wish to have /var/log ready at this stage so execute this after
  124. # populate-volatile.sh
  125. update-rc.d -r ${D} dmesg.sh start 38 S .
  126. }
  127. MASKED_SCRIPTS = " \
  128. banner \
  129. bootmisc \
  130. checkfs \
  131. checkroot \
  132. devpts \
  133. dmesg \
  134. hostname \
  135. mountall \
  136. mountnfs \
  137. populate-volatile \
  138. read-only-rootfs-hook \
  139. rmnologin \
  140. sysfs \
  141. urandom"
  142. pkg_postinst_${PN} () {
  143. if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
  144. if [ -n "$D" ]; then
  145. OPTS="--root=$D"
  146. fi
  147. for SERVICE in ${MASKED_SCRIPTS}; do
  148. systemctl $OPTS mask $SERVICE.service
  149. done
  150. fi
  151. }
  152. CONFFILES_${PN} += "${sysconfdir}/init.d/checkroot.sh"