diff options
Diffstat (limited to 'meta/recipes-core/base-files')
4 files changed, 111 insertions, 31 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/hosts b/meta/recipes-core/base-files/base-files/hosts index b94f414d5c..10a5b6c704 100644 --- a/meta/recipes-core/base-files/base-files/hosts +++ b/meta/recipes-core/base-files/base-files/hosts @@ -1,4 +1,4 @@ -127.0.0.1 localhost.localdomain localhost +127.0.0.1 localhost # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile index 9e4283e0c7..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,12 +25,49 @@ if [ -d /etc/profile.d ]; then unset i fi -# 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 2>/dev/null) in - /dev/tty[A-z]*) [ -x @BINDIR@/resize ] && @BINDIR@/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_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb index 94299431f6..42a8026e63 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: @@ -24,11 +23,13 @@ SRC_URI = "file://rotation \ 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" @@ -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 @@ -112,23 +113,23 @@ do_install () { ln -snf ../run ${D}${localstatedir}/run ln -snf ../run/lock ${D}${localstatedir}/lock - install -m 0644 ${WORKDIR}/hosts ${D}${sysconfdir}/hosts + install -m 0644 ${S}/hosts ${D}${sysconfdir}/hosts ${BASEFILESISSUEINSTALL} - rotation=`cat ${WORKDIR}/rotation` + rotation=`cat ${S}/rotation` if [ "$rotation" != "0" ]; then - install -m 0644 ${WORKDIR}/rotation ${D}${sysconfdir}/rotation + install -m 0644 ${S}/rotation ${D}${sysconfdir}/rotation fi - install -m 0644 ${WORKDIR}/fstab ${D}${sysconfdir}/fstab - install -m 0644 ${WORKDIR}/profile ${D}${sysconfdir}/profile + install -m 0644 ${S}/fstab ${D}${sysconfdir}/fstab + install -m 0644 ${S}/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}/host.conf ${D}${sysconfdir}/host.conf - install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd + install -m 0644 ${S}/shells ${D}${sysconfdir}/shells + install -m 0755 ${S}/share/dot.profile ${D}${sysconfdir}/skel/.profile + install -m 0755 ${S}/share/dot.bashrc ${D}${sysconfdir}/skel/.bashrc + install -m 0644 ${S}/host.conf ${D}${sysconfdir}/host.conf + install -m 0644 ${S}/motd ${D}${sysconfdir}/motd ln -sf /proc/mounts ${D}${sysconfdir}/mtab @@ -137,15 +138,19 @@ do_install () { 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 +do_install:append:libc-glibc () { + install -m 0644 ${S}/nsswitch.conf ${D}${sysconfdir}/nsswitch.conf } DISTRO_VERSION[vardepsexclude] += "DATE" do_install_basefilesissue () { - install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir} + install -m 644 ${S}/issue* ${D}${sysconfdir} if [ -n "${DISTRO_NAME}" ]; then printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net @@ -162,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 @@ -175,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 ${sysconfdir}/hosts'][(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" |