diff options
Diffstat (limited to 'meta/recipes-core/base-files')
7 files changed, 124 insertions, 38 deletions
diff --git a/meta/recipes-core/base-files/base-files/0001-add-nss-resolve-to-nsswitch.patch b/meta/recipes-core/base-files/base-files/0001-add-nss-resolve-to-nsswitch.patch new file mode 100644 index 0000000000..a6e39e0956 --- /dev/null +++ b/meta/recipes-core/base-files/base-files/0001-add-nss-resolve-to-nsswitch.patch @@ -0,0 +1,31 @@ +From 830abe652428d9d31780c3ace121635ad7b64274 Mon Sep 17 00:00:00 2001 +From: Eero Aaltonen <eero.aaltonen@vaisala.com> +Date: Wed Sep 27 15:50:48 2023 +0300 +Subject: [PATCH] Add nss-resolve to the Name Service Switch (NSS) + +Add `nss-resolve` so that `systemd-resolved` is used for name +resolution with glibc `gethostbyname` calls. + +Upstream-Status: Inappropriate [no upstream, configuration]. + +Signed-off-by: Eero Aaltonen <eero.aaltonen@vaisala.com> +--- + nsswitch.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/nsswitch.conf b/nsswitch.conf +index 06f03d2..34b165c 100644 +--- a/nsswitch.conf ++++ b/nsswitch.conf +@@ -8,7 +8,7 @@ passwd: compat + group: compat + shadow: compat + +-hosts: files dns ++hosts: resolve [!UNAVAIL=return] files dns + networks: files + + protocols: db files +-- +2.25.1 + diff --git a/meta/recipes-core/base-files/base-files/filesystems b/meta/recipes-core/base-files/base-files/filesystems deleted file mode 100644 index 7e6c41c38f..0000000000 --- a/meta/recipes-core/base-files/base-files/filesystems +++ /dev/null @@ -1,8 +0,0 @@ -ext4 -ext3 -ext2 -vfat -fat -btrfs -minix -* diff --git a/meta/recipes-core/base-files/base-files/fstab b/meta/recipes-core/base-files/base-files/fstab index d79a01602f..70e400f567 100644 --- a/meta/recipes-core/base-files/base-files/fstab +++ b/meta/recipes-core/base-files/base-files/fstab @@ -2,7 +2,7 @@ /dev/root / auto defaults 1 1 proc /proc proc defaults 0 0 -devpts /dev/pts devpts mode=0620,gid=5 0 0 +devpts /dev/pts devpts mode=0620,ptmxmode=0666,gid=5 0 0 tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0 tmpfs /var/volatile tmpfs defaults 0 0 diff --git a/meta/recipes-core/base-files/base-files/hosts b/meta/recipes-core/base-files/base-files/hosts new file mode 100644 index 0000000000..10a5b6c704 --- /dev/null +++ b/meta/recipes-core/base-files/base-files/hosts @@ -0,0 +1,8 @@ +127.0.0.1 localhost + +# The following lines are desirable for IPv6 capable hosts +::1 localhost ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile index a062028226..bded3757cc 100644 --- a/meta/recipes-core/base-files/base-files/profile +++ b/meta/recipes-core/base-files/base-files/profile @@ -2,7 +2,6 @@ # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). PATH="/usr/local/bin:/usr/bin:/bin" -EDITOR="vi" # needed for packages like cron, git-commit [ "$TERM" ] || TERM="vt100" # Basic terminal capab. For screen etc. # Add /sbin & co to $PATH for the root user @@ -11,6 +10,12 @@ EDITOR="vi" # needed for packages like cron, git-commit # Set the prompt for bash and ash (no other shells known to be in use here) [ -z "$PS1" ] || PS1='\u@\h:\w\$ ' +# Use the EDITOR not being set as a trigger to call resize later on +FIRSTTIMESETUP=0 +if [ -z "$EDITOR" ] ; then + FIRSTTIMESETUP=1 +fi + if [ -d /etc/profile.d ]; then for i in /etc/profile.d/*.sh; do if [ -f $i -a -r $i ]; then @@ -20,13 +25,48 @@ if [ -d /etc/profile.d ]; then unset i fi -if command -v resize >/dev/null && command -v tty >/dev/null; then - # Make sure we are on a serial console (i.e. the device used starts with - # /dev/tty[A-z]), otherwise we confuse e.g. the eclipse launcher which - # tries do use ssh - case $(tty) in - /dev/tty[A-z]*) resize >/dev/null;; - esac +if [ -t 0 -a $# -eq 0 ]; then + if [ ! -x @BINDIR@/resize ] ; then + if [ -n "$BASH_VERSION" ] ; then +# Optimized resize funciton for bash +resize() { + local x y + IFS='[;' read -t 2 -p $(printf '\e7\e[r\e[999;999H\e[6n\e8') -sd R _ y x _ + [ -n "$y" ] && \ + echo -e "COLUMNS=$x;\nLINES=$y;\nexport COLUMNS LINES;" && \ + stty cols $x rows $y +} + else +# Portable resize function for ash/bash/dash/ksh +# with subshell to avoid local variables +resize() { + (o=$(stty -g) + stty -echo raw min 0 time 2 + printf '\0337\033[r\033[999;999H\033[6n\0338' + if echo R | read -d R x 2> /dev/null; then + IFS='[;R' read -t 2 -d R -r z y x _ + else + IFS='[;R' read -r _ y x _ + fi + stty "$o" + [ -z "$y" ] && y=${z##*[}&&x=${y##*;}&&y=${y%%;*} + [ -n "$y" ] && \ + echo "COLUMNS=$x;"&&echo "LINES=$y;"&&echo "export COLUMNS LINES;"&& \ + stty cols $x rows $y) +} + fi + fi + # only do this for /dev/tty[A-z] which are typically + # serial ports + if [ $FIRSTTIMESETUP -eq 1 -a $SHLVL -eq 1 ] ; then + case $(tty 2>/dev/null) in + /dev/tty[A-z]*) resize >/dev/null;; + esac + fi +fi + +if [ -z "$EDITOR" ]; then + EDITOR="vi" # needed for packages like cron, git-commit fi export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM diff --git a/meta/recipes-core/base-files/base-files/usbd b/meta/recipes-core/base-files/base-files/usbd deleted file mode 100644 index e69de29bb2..0000000000 --- a/meta/recipes-core/base-files/base-files/usbd +++ /dev/null diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb index 1c0863b1c7..9fab53ce63 100644 --- a/meta/recipes-core/base-files/base-files_3.0.14.bb +++ b/meta/recipes-core/base-files/base-files_3.0.14.bb @@ -1,8 +1,7 @@ SUMMARY = "Miscellaneous files for the base system" DESCRIPTION = "The base-files package creates the basic system directory structure and provides a small set of key configuration files for the system." SECTION = "base" -PR = "r89" -LICENSE = "GPLv2" +LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://licenses/GPL-2;md5=94d55d512a9ba36caa9b7df079bae19f" # Removed all license related tasks in this recipe as license.bbclass # now deals with this. In order to get accurate licensing on to the image: @@ -13,34 +12,36 @@ LIC_FILES_CHKSUM = "file://licenses/GPL-2;md5=94d55d512a9ba36caa9b7df079bae19f" SRC_URI = "file://rotation \ file://nsswitch.conf \ file://motd \ + file://hosts \ file://host.conf \ file://profile \ file://shells \ file://fstab \ - file://filesystems \ file://issue.net \ file://issue \ - file://usbd \ file://share/dot.bashrc \ file://share/dot.profile \ file://licenses/GPL-2 \ " +SRC_URI:append:libc-glibc = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd systemd-resolved', ' file://0001-add-nss-resolve-to-nsswitch.patch', '', d)}" + S = "${WORKDIR}" INHIBIT_DEFAULT_DEPS = "1" -docdir_append = "/${P}" +docdir:append = "/${P}" dirs1777 = "/tmp ${localstatedir}/volatile/tmp" dirs2775 = "" +dirs555 = "/sys /proc" dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \ ${sysconfdir} ${sysconfdir}/default \ - ${sysconfdir}/skel ${nonarch_base_libdir} /mnt /proc ${ROOT_HOME} /run \ + ${sysconfdir}/skel ${nonarch_base_libdir} /mnt ${ROOT_HOME} /run \ ${prefix} ${bindir} ${docdir} /usr/games ${includedir} \ ${libdir} ${sbindir} ${datadir} \ ${datadir}/common-licenses ${datadir}/dict ${infodir} \ ${mandir} ${datadir}/misc ${localstatedir} \ ${localstatedir}/backups ${localstatedir}/lib \ - /sys ${localstatedir}/lib/misc ${localstatedir}/spool \ + ${localstatedir}/lib/misc ${localstatedir}/spool \ ${localstatedir}/volatile \ ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_LOG_DIR}') else ''}log \ /home ${prefix}/src ${localstatedir}/local \ @@ -64,7 +65,7 @@ conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \ # hostnames. # # The hostname can be changed outside of this recipe by using -# hostname_pn-base-files = "my-host-name". +# hostname:pn-base-files = "my-host-name". hostname = "${MACHINE}" BASEFILESISSUEINSTALL ?= "do_install_basefilesissue" @@ -77,7 +78,7 @@ BASEFILESISSUEINSTALL ?= "do_install_basefilesissue" # Otherwise the directory creation will fail and we will have circular symbolic # links. # -pkg_preinst_${PN} () { +pkg_preinst:${PN} () { #!/bin/sh -e if [ x"$D" = "x" ]; then if [ -h "/var/lock" ]; then @@ -93,6 +94,9 @@ pkg_preinst_${PN} () { } do_install () { + for d in ${dirs555}; do + install -m 0555 -d ${D}$d + done for d in ${dirs755}; do install -m 0755 -d ${D}$d done @@ -109,6 +113,7 @@ do_install () { ln -snf ../run ${D}${localstatedir}/run ln -snf ../run/lock ${D}${localstatedir}/lock + install -m 0644 ${WORKDIR}/hosts ${D}${sysconfdir}/hosts ${BASEFILESISSUEINSTALL} rotation=`cat ${WORKDIR}/rotation` @@ -117,32 +122,40 @@ do_install () { fi install -m 0644 ${WORKDIR}/fstab ${D}${sysconfdir}/fstab - install -m 0644 ${WORKDIR}/filesystems ${D}${sysconfdir}/filesystems - install -m 0644 ${WORKDIR}/usbd ${D}${sysconfdir}/default/usbd install -m 0644 ${WORKDIR}/profile ${D}${sysconfdir}/profile sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}${sysconfdir}/profile + sed -i 's#@BINDIR@#${bindir}#g' ${D}${sysconfdir}/profile install -m 0644 ${WORKDIR}/shells ${D}${sysconfdir}/shells install -m 0755 ${WORKDIR}/share/dot.profile ${D}${sysconfdir}/skel/.profile install -m 0755 ${WORKDIR}/share/dot.bashrc ${D}${sysconfdir}/skel/.bashrc - install -m 0644 ${WORKDIR}/nsswitch.conf ${D}${sysconfdir}/nsswitch.conf install -m 0644 ${WORKDIR}/host.conf ${D}${sysconfdir}/host.conf install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd ln -sf /proc/mounts ${D}${sysconfdir}/mtab -} -DISTRO_VERSION[vardepsexclude] += "DATE" -do_install_basefilesissue () { + # deal with hostname if [ "${hostname}" ]; then echo ${hostname} > ${D}${sysconfdir}/hostname + echo "127.0.1.1 ${hostname}" >> ${D}${sysconfdir}/hosts fi + if ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'false', 'true', d)}; then + sed -i '/^::1/s/ localhost//' ${D}${sysconfdir}/hosts + fi +} + +do_install:append:libc-glibc () { + install -m 0644 ${WORKDIR}/nsswitch.conf ${D}${sysconfdir}/nsswitch.conf +} + +DISTRO_VERSION[vardepsexclude] += "DATE" +do_install_basefilesissue () { install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir} if [ -n "${DISTRO_NAME}" ]; then printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net if [ -n "${DISTRO_VERSION}" ]; then - distro_version_nodate=${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot').replace('${DATE}','')} + distro_version_nodate="${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}','snapshot').replace('${DATE}','')}" printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue.net fi @@ -154,7 +167,7 @@ do_install_basefilesissue () { } do_install_basefilesissue[vardepsexclude] += "DATE" -do_install_append_linuxstdbase() { +do_install:append:linuxstdbase() { for d in ${dirs755-lsb}; do install -m 0755 -d ${D}$d done @@ -167,10 +180,12 @@ do_install_append_linuxstdbase() { SYSROOT_DIRS += "${sysconfdir}/skel" PACKAGES = "${PN}-doc ${PN} ${PN}-dev ${PN}-dbg" -FILES_${PN} = "/" -FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses" +FILES:${PN} = "/" +FILES:${PN}-doc = "${docdir} ${datadir}/common-licenses" PACKAGE_ARCH = "${MACHINE_ARCH}" -CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname') != '')]} ${sysconfdir}/shells" -CONFFILES_${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile" +CONFFILES:${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname ${sysconfdir}/hosts'][(d.getVar('hostname') != '')]} ${sysconfdir}/shells" +CONFFILES:${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile" + +INSANE_SKIP:${PN} += "empty-dirs" |