base-files_3.0.14.bb 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. SUMMARY = "Miscellaneous files for the base system"
  2. DESCRIPTION = "The base-files package creates the basic system directory structure and provides a small set of key configuration files for the system."
  3. SECTION = "base"
  4. LICENSE = "GPL-2.0-only"
  5. LIC_FILES_CHKSUM = "file://licenses/GPL-2;md5=94d55d512a9ba36caa9b7df079bae19f"
  6. # Removed all license related tasks in this recipe as license.bbclass
  7. # now deals with this. In order to get accurate licensing on to the image:
  8. # Set COPY_LIC_MANIFEST to just copy just the license.manifest to the image
  9. # For the manifest and the license text for each package:
  10. # Set COPY_LIC_MANIFEST and COPY_LIC_DIRS
  11. SRC_URI = "file://rotation \
  12. file://nsswitch.conf \
  13. file://motd \
  14. file://hosts \
  15. file://host.conf \
  16. file://profile \
  17. file://shells \
  18. file://fstab \
  19. file://issue.net \
  20. file://issue \
  21. file://share/dot.bashrc \
  22. file://share/dot.profile \
  23. file://licenses/GPL-2 \
  24. "
  25. SRC_URI:append:libc-glibc = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd systemd-resolved', ' file://0001-add-nss-resolve-to-nsswitch.patch', '', d)}"
  26. S = "${WORKDIR}/sources"
  27. UNPACKDIR = "${S}"
  28. INHIBIT_DEFAULT_DEPS = "1"
  29. docdir:append = "/${P}"
  30. dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
  31. dirs2775 = ""
  32. dirs555 = "/sys /proc"
  33. dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \
  34. ${sysconfdir} ${sysconfdir}/default \
  35. ${sysconfdir}/skel ${nonarch_base_libdir} /mnt ${ROOT_HOME} /run \
  36. ${prefix} ${bindir} ${docdir} /usr/games ${includedir} \
  37. ${libdir} ${sbindir} ${datadir} \
  38. ${datadir}/common-licenses ${datadir}/dict ${infodir} \
  39. ${mandir} ${datadir}/misc ${localstatedir} \
  40. ${localstatedir}/backups ${localstatedir}/lib \
  41. ${localstatedir}/lib/misc ${localstatedir}/spool \
  42. ${localstatedir}/volatile \
  43. ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_LOG_DIR}') else ''}log \
  44. /home ${prefix}/src ${localstatedir}/local \
  45. /media"
  46. dirs755-lsb = "/srv \
  47. ${prefix}/local ${prefix}/local/bin ${prefix}/local/games \
  48. ${prefix}/local/include ${prefix}/local/lib ${prefix}/local/sbin \
  49. ${prefix}/local/share ${prefix}/local/src \
  50. ${prefix}/lib/locale"
  51. dirs2775-lsb = "/var/mail"
  52. volatiles = "${@'log' if oe.types.boolean('${VOLATILE_LOG_DIR}') else ''} tmp"
  53. conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
  54. ${sysconfdir}/issue /${sysconfdir}/issue.net \
  55. ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
  56. ${sysconfdir}/default"
  57. # By default the hostname is the machine name. If the hostname is unset then a
  58. # /etc/hostname file isn't written, suitable for environments with dynamic
  59. # hostnames.
  60. #
  61. # The hostname can be changed outside of this recipe by using
  62. # hostname:pn-base-files = "my-host-name".
  63. hostname = "${MACHINE}"
  64. BASEFILESISSUEINSTALL ?= "do_install_basefilesissue"
  65. # In previous versions of base-files, /run was a softlink to /var/run and the
  66. # directory was located in /var/volatlie/run. Also, /var/lock was a softlink
  67. # to /var/volatile/lock which is where the real directory was located. Now,
  68. # /run and /run/lock are the real directories. If we are upgrading, we may
  69. # need to remove the symbolic links first before we create the directories.
  70. # Otherwise the directory creation will fail and we will have circular symbolic
  71. # links.
  72. #
  73. pkg_preinst:${PN} () {
  74. #!/bin/sh -e
  75. if [ x"$D" = "x" ]; then
  76. if [ -h "/var/lock" ]; then
  77. # Remove the symbolic link
  78. rm -f /var/lock
  79. fi
  80. if [ -h "/run" ]; then
  81. # Remove the symbolic link
  82. rm -f /run
  83. fi
  84. fi
  85. }
  86. do_install () {
  87. for d in ${dirs555}; do
  88. install -m 0555 -d ${D}$d
  89. done
  90. for d in ${dirs755}; do
  91. install -m 0755 -d ${D}$d
  92. done
  93. for d in ${dirs1777}; do
  94. install -m 1777 -d ${D}$d
  95. done
  96. for d in ${dirs2775}; do
  97. install -m 2775 -d ${D}$d
  98. done
  99. for d in ${volatiles}; do
  100. ln -sf volatile/$d ${D}${localstatedir}/$d
  101. done
  102. ln -snf ../run ${D}${localstatedir}/run
  103. ln -snf ../run/lock ${D}${localstatedir}/lock
  104. install -m 0644 ${S}/hosts ${D}${sysconfdir}/hosts
  105. ${BASEFILESISSUEINSTALL}
  106. rotation=`cat ${S}/rotation`
  107. if [ "$rotation" != "0" ]; then
  108. install -m 0644 ${S}/rotation ${D}${sysconfdir}/rotation
  109. fi
  110. install -m 0644 ${S}/fstab ${D}${sysconfdir}/fstab
  111. install -m 0644 ${S}/profile ${D}${sysconfdir}/profile
  112. sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}${sysconfdir}/profile
  113. sed -i 's#@BINDIR@#${bindir}#g' ${D}${sysconfdir}/profile
  114. install -m 0644 ${S}/shells ${D}${sysconfdir}/shells
  115. install -m 0755 ${S}/share/dot.profile ${D}${sysconfdir}/skel/.profile
  116. install -m 0755 ${S}/share/dot.bashrc ${D}${sysconfdir}/skel/.bashrc
  117. install -m 0644 ${S}/host.conf ${D}${sysconfdir}/host.conf
  118. install -m 0644 ${S}/motd ${D}${sysconfdir}/motd
  119. ln -sf /proc/mounts ${D}${sysconfdir}/mtab
  120. # deal with hostname
  121. if [ "${hostname}" ]; then
  122. echo ${hostname} > ${D}${sysconfdir}/hostname
  123. echo "127.0.1.1 ${hostname}" >> ${D}${sysconfdir}/hosts
  124. fi
  125. if ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'false', 'true', d)}; then
  126. sed -i '/^::1/s/ localhost//' ${D}${sysconfdir}/hosts
  127. fi
  128. }
  129. do_install:append:libc-glibc () {
  130. install -m 0644 ${S}/nsswitch.conf ${D}${sysconfdir}/nsswitch.conf
  131. }
  132. DISTRO_VERSION[vardepsexclude] += "DATE"
  133. do_install_basefilesissue () {
  134. install -m 644 ${S}/issue* ${D}${sysconfdir}
  135. if [ -n "${DISTRO_NAME}" ]; then
  136. printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
  137. printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
  138. if [ -n "${DISTRO_VERSION}" ]; then
  139. distro_version_nodate="${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}','snapshot').replace('${DATE}','')}"
  140. printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue
  141. printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue.net
  142. fi
  143. printf "\\\n \\\l\n" >> ${D}${sysconfdir}/issue
  144. echo >> ${D}${sysconfdir}/issue
  145. echo "%h" >> ${D}${sysconfdir}/issue.net
  146. echo >> ${D}${sysconfdir}/issue.net
  147. fi
  148. }
  149. do_install_basefilesissue[vardepsexclude] += "DATE"
  150. do_install:append:linuxstdbase() {
  151. for d in ${dirs755-lsb}; do
  152. install -m 0755 -d ${D}$d
  153. done
  154. for d in ${dirs2775-lsb}; do
  155. install -m 2775 -d ${D}$d
  156. done
  157. }
  158. SYSROOT_DIRS += "${sysconfdir}/skel"
  159. PACKAGES = "${PN}-doc ${PN} ${PN}-dev ${PN}-dbg"
  160. FILES:${PN} = "/"
  161. FILES:${PN}-doc = "${docdir} ${datadir}/common-licenses"
  162. PACKAGE_ARCH = "${MACHINE_ARCH}"
  163. CONFFILES:${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname ${sysconfdir}/hosts'][(d.getVar('hostname') != '')]} ${sysconfdir}/shells"
  164. CONFFILES:${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile"
  165. INSANE_SKIP:${PN} += "empty-dirs"