base-files_3.0.14.bb 6.6 KB

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