blob: d3917073763933064cfb8f88282dd5185d895a32 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Miscellaneous files for the base system"
2DESCRIPTION = "The base-files package creates the basic system directory structure and provides a small set of key configuration files for the system."
3SECTION = "base"
4PR = "r89"
5LICENSE = "GPLv2"
6LIC_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
13SRC_URI = "file://rotation \
14 file://nsswitch.conf \
15 file://motd \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050016 file://host.conf \
17 file://profile \
18 file://shells \
19 file://fstab \
20 file://filesystems \
21 file://issue.net \
22 file://issue \
23 file://usbd \
24 file://share/dot.bashrc \
25 file://share/dot.profile \
26 file://licenses/GPL-2 \
27 "
28S = "${WORKDIR}"
29
30INHIBIT_DEFAULT_DEPS = "1"
31
32docdir_append = "/${P}"
33dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
34dirs2775 = ""
35dirs755 = "/bin /boot /dev ${sysconfdir} ${sysconfdir}/default \
36 ${sysconfdir}/skel /lib /mnt /proc ${ROOT_HOME} /run /sbin \
37 ${prefix} ${bindir} ${docdir} /usr/games ${includedir} \
38 ${libdir} ${sbindir} ${datadir} \
39 ${datadir}/common-licenses ${datadir}/dict ${infodir} \
40 ${mandir} ${datadir}/misc ${localstatedir} \
41 ${localstatedir}/backups ${localstatedir}/lib \
42 /sys ${localstatedir}/lib/misc ${localstatedir}/spool \
43 ${localstatedir}/volatile \
44 ${localstatedir}/volatile/log \
45 /home ${prefix}/src ${localstatedir}/local \
46 /media"
47
48dirs755-lsb = "/srv \
49 ${prefix}/local ${prefix}/local/bin ${prefix}/local/games \
50 ${prefix}/local/include ${prefix}/local/lib ${prefix}/local/sbin \
51 ${prefix}/local/share ${prefix}/local/src \
52 ${prefix}/lib/locale"
53dirs2775-lsb = "/var/mail"
54
55volatiles = "log tmp"
56conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050057 ${sysconfdir}/issue /${sysconfdir}/issue.net \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050058 ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
59 ${sysconfdir}/default"
60
61# By default the hostname is the machine name. If the hostname is unset then a
62# /etc/hostname file isn't written, suitable for environments with dynamic
63# hostnames.
64#
65# The hostname can be changed outside of this recipe by using
66# hostname_pn-base-files = "my-host-name".
67hostname = "${MACHINE}"
68
69BASEFILESISSUEINSTALL ?= "do_install_basefilesissue"
70
71# In previous versions of base-files, /run was a softlink to /var/run and the
72# directory was located in /var/volatlie/run. Also, /var/lock was a softlink
73# to /var/volatile/lock which is where the real directory was located. Now,
74# /run and /run/lock are the real directories. If we are upgrading, we may
75# need to remove the symbolic links first before we create the directories.
76# Otherwise the directory creation will fail and we will have circular symbolic
77# links.
78#
79pkg_preinst_${PN} () {
80 #!/bin/sh -e
81 if [ x"$D" = "x" ]; then
82 if [ -h "/var/lock" ]; then
83 # Remove the symbolic link
84 rm -f /var/lock
85 fi
86
87 if [ -h "/run" ]; then
88 # Remove the symbolic link
89 rm -f /run
90 fi
91 fi
92}
93
94do_install () {
95 for d in ${dirs755}; do
96 install -m 0755 -d ${D}$d
97 done
98 for d in ${dirs1777}; do
99 install -m 1777 -d ${D}$d
100 done
101 for d in ${dirs2775}; do
102 install -m 2775 -d ${D}$d
103 done
104 for d in ${volatiles}; do
105 ln -sf volatile/$d ${D}${localstatedir}/$d
106 done
107
108 ln -snf ../run ${D}${localstatedir}/run
109 ln -snf ../run/lock ${D}${localstatedir}/lock
110
111 ${BASEFILESISSUEINSTALL}
112
113 rotation=`cat ${WORKDIR}/rotation`
114 if [ "$rotation" != "0" ]; then
115 install -m 0644 ${WORKDIR}/rotation ${D}${sysconfdir}/rotation
116 fi
117
118 install -m 0644 ${WORKDIR}/fstab ${D}${sysconfdir}/fstab
119 install -m 0644 ${WORKDIR}/filesystems ${D}${sysconfdir}/filesystems
120 install -m 0644 ${WORKDIR}/usbd ${D}${sysconfdir}/default/usbd
121 install -m 0644 ${WORKDIR}/profile ${D}${sysconfdir}/profile
122 sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}${sysconfdir}/profile
123 install -m 0644 ${WORKDIR}/shells ${D}${sysconfdir}/shells
124 install -m 0755 ${WORKDIR}/share/dot.profile ${D}${sysconfdir}/skel/.profile
125 install -m 0755 ${WORKDIR}/share/dot.bashrc ${D}${sysconfdir}/skel/.bashrc
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500126 install -m 0644 ${WORKDIR}/nsswitch.conf ${D}${sysconfdir}/nsswitch.conf
127 install -m 0644 ${WORKDIR}/host.conf ${D}${sysconfdir}/host.conf
128 install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd
129
130 if [ "/usr/bin" != "${bindir}" ]; then
131 sed -i "s,/usr/bin/resize,${bindir}/resize," ${D}${sysconfdir}/profile
132 fi
133
134 ln -sf /proc/mounts ${D}${sysconfdir}/mtab
135}
136
137DISTRO_VERSION[vardepsexclude] += "DATE"
138do_install_basefilesissue () {
139 if [ "${hostname}" ]; then
140 echo ${hostname} > ${D}${sysconfdir}/hostname
141 fi
142
143 install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir}
144 if [ -n "${DISTRO_NAME}" ]; then
145 printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
146 printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
147 if [ -n "${DISTRO_VERSION}" ]; then
148 printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue
149 printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue.net
150 fi
151 printf "\\\n \\\l\n" >> ${D}${sysconfdir}/issue
152 echo >> ${D}${sysconfdir}/issue
153 echo "%h" >> ${D}${sysconfdir}/issue.net
154 echo >> ${D}${sysconfdir}/issue.net
155 fi
156}
157
158do_install_append_linuxstdbase() {
159 for d in ${dirs755-lsb}; do
160 install -m 0755 -d ${D}$d
161 done
162
163 for d in ${dirs2775-lsb}; do
164 install -m 2775 -d ${D}$d
165 done
166}
167
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500168sysroot_stage_all_append () {
169 sysroot_stage_dir ${D}${sysconfdir}/skel ${SYSROOT_DESTDIR}${sysconfdir}/skel
170}
171
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500172PACKAGES = "${PN}-doc ${PN} ${PN}-dev ${PN}-dbg"
173FILES_${PN} = "/"
174FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
175
176PACKAGE_ARCH = "${MACHINE_ARCH}"
177
178CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname', True) != '')]} ${sysconfdir}/shells"
179CONFFILES_${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile"
180