base-files_3.0.14.bb 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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://nsswitch-resolved.conf \
  14. file://motd \
  15. file://hosts \
  16. file://host.conf \
  17. file://profile \
  18. file://shells \
  19. file://fstab \
  20. file://issue.net \
  21. file://issue \
  22. file://share/dot.bashrc \
  23. file://share/dot.profile \
  24. file://licenses/GPL-2 \
  25. "
  26. S = "${WORKDIR}/sources"
  27. UNPACKDIR = "${S}"
  28. INHIBIT_DEFAULT_DEPS = "1"
  29. docdir:append = "/${P}"
  30. dirs1777 = "/tmp ${localstatedir}/${@bb.utils.contains('FILESYSTEM_PERMS_TABLES', 'files/fs-perms-volatile-tmp.txt', 'volatile/', '', d)}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}/${@bb.utils.contains('FILESYSTEM_PERMS_TABLES', 'files/fs-perms-volatile-log.txt', 'volatile/', '', d)}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 = "${@bb.utils.contains('FILESYSTEM_PERMS_TABLES', 'files/fs-perms-volatile-log.txt', 'log', '', d)} \
  53. ${@bb.utils.contains('FILESYSTEM_PERMS_TABLES', 'files/fs-perms-volatile-tmp.txt', 'tmp', '', d)}"
  54. conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
  55. ${sysconfdir}/issue /${sysconfdir}/issue.net \
  56. ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
  57. ${sysconfdir}/default"
  58. # By default the hostname is the machine name. If the hostname is unset then a
  59. # /etc/hostname file isn't written, suitable for environments with dynamic
  60. # hostnames.
  61. #
  62. # The hostname can be changed outside of this recipe by using
  63. # hostname:pn-base-files = "my-host-name".
  64. hostname = "${MACHINE}"
  65. BASEFILESISSUEINSTALL ?= "do_install_basefilesissue"
  66. do_install () {
  67. for d in ${dirs555}; do
  68. install -m 0555 -d ${D}$d
  69. done
  70. for d in ${dirs755}; do
  71. install -m 0755 -d ${D}$d
  72. done
  73. for d in ${dirs1777}; do
  74. install -m 1777 -d ${D}$d
  75. done
  76. for d in ${dirs2775}; do
  77. install -m 2775 -d ${D}$d
  78. done
  79. for d in ${volatiles}; do
  80. ln -sf volatile/$d ${D}${localstatedir}/$d
  81. done
  82. ln -snf ../run ${D}${localstatedir}/run
  83. ln -snf ../run/lock ${D}${localstatedir}/lock
  84. install -m 0644 ${S}/hosts ${D}${sysconfdir}/hosts
  85. ${BASEFILESISSUEINSTALL}
  86. rotation=`cat ${S}/rotation`
  87. if [ "$rotation" != "0" ]; then
  88. install -m 0644 ${S}/rotation ${D}${sysconfdir}/rotation
  89. fi
  90. install -m 0644 ${S}/fstab ${D}${sysconfdir}/fstab
  91. install -m 0644 ${S}/profile ${D}${sysconfdir}/profile
  92. sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}${sysconfdir}/profile
  93. sed -i 's#@BINDIR@#${bindir}#g' ${D}${sysconfdir}/profile
  94. install -m 0644 ${S}/shells ${D}${sysconfdir}/shells
  95. install -m 0755 ${S}/share/dot.profile ${D}${sysconfdir}/skel/.profile
  96. install -m 0755 ${S}/share/dot.bashrc ${D}${sysconfdir}/skel/.bashrc
  97. install -m 0644 ${S}/host.conf ${D}${sysconfdir}/host.conf
  98. install -m 0644 ${S}/motd ${D}${sysconfdir}/motd
  99. ln -sf /proc/mounts ${D}${sysconfdir}/mtab
  100. # deal with hostname
  101. if [ "${hostname}" ]; then
  102. echo ${hostname} > ${D}${sysconfdir}/hostname
  103. echo "127.0.1.1 ${hostname}" >> ${D}${sysconfdir}/hosts
  104. fi
  105. if ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'false', 'true', d)}; then
  106. sed -i '/^::1/s/ localhost//' ${D}${sysconfdir}/hosts
  107. fi
  108. }
  109. do_install:append:libc-glibc () {
  110. install -m 0644 ${S}/${@bb.utils.contains('DISTRO_FEATURES', 'systemd systemd-resolved', 'nsswitch-resolved.conf', 'nsswitch.conf', d)} ${D}${sysconfdir}/nsswitch.conf
  111. }
  112. DISTRO_VERSION[vardepsexclude] += "DATE"
  113. do_install_basefilesissue () {
  114. install -m 644 ${S}/issue* ${D}${sysconfdir}
  115. if [ -n "${DISTRO_NAME}" ]; then
  116. printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
  117. printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
  118. if [ -n "${DISTRO_VERSION}" ]; then
  119. distro_version_nodate="${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}','snapshot').replace('${DATE}','')}"
  120. printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue
  121. printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue.net
  122. fi
  123. printf "\\\n \\\l\n" >> ${D}${sysconfdir}/issue
  124. echo >> ${D}${sysconfdir}/issue
  125. echo "%h" >> ${D}${sysconfdir}/issue.net
  126. echo >> ${D}${sysconfdir}/issue.net
  127. fi
  128. }
  129. do_install_basefilesissue[vardepsexclude] += "DATE"
  130. do_install:append:linuxstdbase() {
  131. for d in ${dirs755-lsb}; do
  132. install -m 0755 -d ${D}$d
  133. done
  134. for d in ${dirs2775-lsb}; do
  135. install -m 2775 -d ${D}$d
  136. done
  137. }
  138. SYSROOT_DIRS += "${sysconfdir}/skel"
  139. PACKAGES = "${PN}-doc ${PN} ${PN}-dev ${PN}-dbg"
  140. FILES:${PN} = "/"
  141. FILES:${PN}-doc = "${docdir} ${datadir}/common-licenses"
  142. PACKAGE_ARCH = "${MACHINE_ARCH}"
  143. CONFFILES:${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname ${sysconfdir}/hosts'][(d.getVar('hostname') != '')]} ${sysconfdir}/shells"
  144. CONFFILES:${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile"
  145. INSANE_SKIP:${PN} += "empty-dirs"