From e374c6bc04c7c931346f52651bae5b3ef2235a3e Mon Sep 17 00:00:00 2001 From: Henning Heinold Date: Tue, 12 May 2015 20:41:27 +0200 Subject: [PATCH 1/3] busybox-udhcpc: add default file to control the modification of /etc/resolv.conf - using commit aee3a65e2aa748e6cc78a08d9bbb14003fb86f93, which fixes the route metrics from holger for all machines Fixes: SYS#1126 --- recipes-core/busybox/busybox_sysmocom.inc | 7 +++- .../files/{sysmocom-idu => }/simple.script | 32 +++++++++++-------- recipes-core/busybox/files/udhcpc.default | 2 ++ 3 files changed, 27 insertions(+), 14 deletions(-) rename recipes-core/busybox/files/{sysmocom-idu => }/simple.script (83%) create mode 100644 recipes-core/busybox/files/udhcpc.default diff --git a/recipes-core/busybox/busybox_sysmocom.inc b/recipes-core/busybox/busybox_sysmocom.inc index e29f906238..76a469e946 100644 --- a/recipes-core/busybox/busybox_sysmocom.inc +++ b/recipes-core/busybox/busybox_sysmocom.inc @@ -1,21 +1,25 @@ SYSMOCOM := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}" FILESEXTRAPATHS_prepend := "${SYSMOCOM}/busybox-${SYSMOCOM_ORIG_PV}:${SYSMOCOM}/files:" -PRINC = "26" +PRINC = "27" SRC_URI += "file://busybox-ifplugd.sh \ file://ifplugd.sh \ file://udhcpc-ntp.sh \ file://udhcpc-ntp.default \ + file://udhcpc.default \ " PACKAGES =+ "${PN}-ifplugd ${PN}-udhcpc-ntp" +FILES_${PN}-udhcpc += "${sysconfdir}/default/udhcpc" + FILES_${PN}-ifplugd = "${sysconfdir}/ifplugd.sh ${sysconfdir}/init.d/busybox-ifplugd.sh" FILES_${PN}-udhcpc-ntp = "${sysconfdir}/udhcpc.d/60ntp \ ${sysconfdir}/default/udhcpc-ntp \ " +CONFFILES_${PN}-udhcpc += "${sysconfdir}/default/udhcpc" CONFFILES_${PN}-udhcpc-ntp = "${sysconfdir}/default/udhcpc-ntp" INITSCRIPT_PACKAGES += "${PN}-ifplugd" @@ -30,4 +34,5 @@ do_install_append() { install -m 0755 ${WORKDIR}/udhcpc-ntp.sh ${D}/${sysconfdir}/udhcpc.d/60ntp install -d ${D}/${sysconfdir}/default install -m 0644 ${WORKDIR}/udhcpc-ntp.default ${D}/${sysconfdir}/default/udhcpc-ntp + install -m 0644 ${WORKDIR}/udhcpc.default ${D}/${sysconfdir}/default/udhcpc } diff --git a/recipes-core/busybox/files/sysmocom-idu/simple.script b/recipes-core/busybox/files/simple.script similarity index 83% rename from recipes-core/busybox/files/sysmocom-idu/simple.script rename to recipes-core/busybox/files/simple.script index cb9d3d4f0c..d8c375ad44 100644 --- a/recipes-core/busybox/files/sysmocom-idu/simple.script +++ b/recipes-core/busybox/files/simple.script @@ -4,7 +4,12 @@ [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 + + RESOLV_CONF="/etc/resolv.conf" + +[ -r /etc/default/udhcpc ] && . /etc/default/udhcpc + [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" [ -n "$subnet" ] && NETMASK="netmask $subnet" @@ -64,22 +69,23 @@ case "$1" in metric=$(($metric + 1)) done fi - - # Update resolver configuration file - R="" - [ -n "$domain" ] && R="domain $domain + if [ "$STATIC_DNS" != "yes" ]; then + # Update resolver configuration file + R="" + [ -n "$domain" ] && R="domain $domain " - for i in $dns; do - echo "$0: Adding DNS $i" - R="${R}nameserver $i + for i in $dns; do + echo "$0: Adding DNS $i" + R="${R}nameserver $i " - done + done - if [ -x /sbin/resolvconf ]; then - echo -n "$R" | /sbin/resolvconf -a "${interface}.udhcpc" - else - echo -n "$R" > "$RESOLV_CONF" - fi + if [ -x /sbin/resolvconf ]; then + echo -n "$R" | /sbin/resolvconf -a "${interface}.udhcpc" + else + echo -n "$R" > "$RESOLV_CONF" + fi + fi ;; esac diff --git a/recipes-core/busybox/files/udhcpc.default b/recipes-core/busybox/files/udhcpc.default new file mode 100644 index 0000000000..4b04b5d1cb --- /dev/null +++ b/recipes-core/busybox/files/udhcpc.default @@ -0,0 +1,2 @@ +# Uncomment the following line, if udhcpc should not touch /etc/resolv.conf +# STATIC_DNS="yes" From 8b5f88e80bb9f419e728c9a30cf23901d8c2891b Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 15 May 2015 11:12:02 +0200 Subject: [PATCH 2/3] syslog: Do not re-create the symbolic link In SYS#659 we wanted that "file" will always log to a persistent /var/log. After I changed the /etc/default/volatiles/00_core for the IDU and made journald persistent we still ended up having the symlink. It appears to be caused by this script. * When "buffer" is used we don't need to care about /var/log as it is not being used at all. * When "file" is set we make sure that /var/log is not a symlink. In case of the IDU the journald should now be persistent. Related: SYS#659 --- recipes-core/busybox/busybox-systemd/busybox-syslog.default | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/recipes-core/busybox/busybox-systemd/busybox-syslog.default b/recipes-core/busybox/busybox-systemd/busybox-syslog.default index 7af29532b4..3524da8bea 100644 --- a/recipes-core/busybox/busybox-systemd/busybox-syslog.default +++ b/recipes-core/busybox/busybox-systemd/busybox-syslog.default @@ -2,11 +2,7 @@ . /etc/syslog-startup.conf # check if we want permanent log files and prepare /var/log -if [ "${DESTINATION}" = "buffer" -a ! -h /var/log ]; then - rm -rf /var/log - cd /var - ln -s volatile/log log -elif [ "${DESTINATION}" = "file" -a -h "/var/log" ]; then +if [ "${DESTINATION}" = "file" -a -h "/var/log" ]; then rm -rf /var/log mkdir /var/log fi From a89b5587e2601c6a325e7a748f392fb8025df515 Mon Sep 17 00:00:00 2001 From: Henning Heinold Date: Tue, 19 May 2015 17:23:39 +0200 Subject: [PATCH 3/3] image-static-dns.bb: new image snippet to set a static dns configuration Fixes: SYS#1126 --- recipes-apps/images/image-static-dns.inc | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 recipes-apps/images/image-static-dns.inc diff --git a/recipes-apps/images/image-static-dns.inc b/recipes-apps/images/image-static-dns.inc new file mode 100644 index 0000000000..26bae4985b --- /dev/null +++ b/recipes-apps/images/image-static-dns.inc @@ -0,0 +1,29 @@ +# set the variables DNS_SERVER, DNS_DOMAIN or DNS_SEARCH in your image file +# and require this file afterwards + +DNSSERVER = "${@d.getVar('DNS_SERVER', True) or ''}" +DNSDOMAIN = "${@d.getVar('DNS_DOMAIN', True) or ''}" +DNSSEARCH = "${@d.getVar('DNS_SEARCH', True) or ''}" + +ROOTFS_POSTPROCESS_COMMAND += "set_static_dns;" + +set_static_dns() { + echo "#created by image-static-dns.inc" > ${IMAGE_ROOTFS}/etc/resolv.conf + if [ -n "${DNSSERVER}" ]; then + printf "setting DNS-server\n" + echo "nameserver ${DNSSERVER}" >> ${IMAGE_ROOTFS}/etc/resolv.conf + fi + if [ -n "${DNSDOMAIN}" ]; then + printf "setting DNS-domain\n" + echo "domain ${DNSDOMAIN}" >> ${IMAGE_ROOTFS}/etc/resolv.conf + fi + + if [ -n "${DNSSEARCH}" ]; then + printf "seting DNS-search\n" + echo "search ${DNSSEARCH}" >> ${IMAGE_ROOTFS}/etc/resolv.conf + fi + + if [ -w ${IMAGE_ROOTFS}/default/udhcpc ]; then + sed -i -e "s/^#.*\(STATIC_DNS\).*$/\1=yes/g" ${IMAGE_ROOTFS}/default/udhcpc + fi +}