base-files_3.0.14.bb 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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://host.conf \
  16. file://profile \
  17. file://shells \
  18. file://fstab \
  19. file://filesystems \
  20. file://issue.net \
  21. file://issue \
  22. file://usbd \
  23. file://share/dot.bashrc \
  24. file://share/dot.profile \
  25. file://licenses/GPL-2 \
  26. "
  27. S = "${WORKDIR}"
  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. ${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}/filesystems ${D}${sysconfdir}/filesystems
  111. install -m 0644 ${WORKDIR}/usbd ${D}${sysconfdir}/default/usbd
  112. install -m 0644 ${WORKDIR}/profile ${D}${sysconfdir}/profile
  113. sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}${sysconfdir}/profile
  114. sed -i 's#@BINDIR@#${bindir}#g' ${D}${sysconfdir}/profile
  115. install -m 0644 ${WORKDIR}/shells ${D}${sysconfdir}/shells
  116. install -m 0755 ${WORKDIR}/share/dot.profile ${D}${sysconfdir}/skel/.profile
  117. install -m 0755 ${WORKDIR}/share/dot.bashrc ${D}${sysconfdir}/skel/.bashrc
  118. install -m 0644 ${WORKDIR}/nsswitch.conf ${D}${sysconfdir}/nsswitch.conf
  119. install -m 0644 ${WORKDIR}/host.conf ${D}${sysconfdir}/host.conf
  120. install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd
  121. ln -sf /proc/mounts ${D}${sysconfdir}/mtab
  122. }
  123. DISTRO_VERSION[vardepsexclude] += "DATE"
  124. do_install_basefilesissue () {
  125. if [ "${hostname}" ]; then
  126. echo ${hostname} > ${D}${sysconfdir}/hostname
  127. fi
  128. install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir}
  129. if [ -n "${DISTRO_NAME}" ]; then
  130. printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
  131. printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
  132. if [ -n "${DISTRO_VERSION}" ]; then
  133. distro_version_nodate=${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot').replace('${DATE}','')}
  134. printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue
  135. printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue.net
  136. fi
  137. printf "\\\n \\\l\n" >> ${D}${sysconfdir}/issue
  138. echo >> ${D}${sysconfdir}/issue
  139. echo "%h" >> ${D}${sysconfdir}/issue.net
  140. echo >> ${D}${sysconfdir}/issue.net
  141. fi
  142. }
  143. do_install_basefilesissue[vardepsexclude] += "DATE"
  144. do_install_append_linuxstdbase() {
  145. for d in ${dirs755-lsb}; do
  146. install -m 0755 -d ${D}$d
  147. done
  148. for d in ${dirs2775-lsb}; do
  149. install -m 2775 -d ${D}$d
  150. done
  151. }
  152. SYSROOT_DIRS += "${sysconfdir}/skel"
  153. PACKAGES = "${PN}-doc ${PN} ${PN}-dev ${PN}-dbg"
  154. FILES_${PN} = "/"
  155. FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
  156. PACKAGE_ARCH = "${MACHINE_ARCH}"
  157. CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname') != '')]} ${sysconfdir}/shells"
  158. CONFFILES_${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile"