From c32b0df2e3a89b70f27767dcd47721e5840d5fee Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 20 Apr 2015 09:39:49 -0400 Subject: [PATCH] ifupdown: Revert the tmpfiles.d change as the dir is created too late It looks like on my tests with the sysmobts I was saved by busybox-ifplogd executing ifup again. I couldn't figure out the dependencies between the LSB networking service and the tmpfiles.d interaction. So instead of winning a beauty contest we will need to create the directory by hand. Cause: SYS#1514 Revert "ifupdown: Package the new file as well" This reverts commit 15dc869cdacf69bb3728ff0d47f7ff1ffbe18fca. Revert "ifupdown: Try the workdir for the files we copied" This reverts commit 1ef790672e6bdb4ae7e281dcb71edb674c931474. Revert "ifupdown: Create /run/network through a tmpfiles.d" This reverts commit e0c7f3c62132ff7b1a9c7d2c01ef2be60c6c0ddc. --- .../init-ifupdown/sysmocom-idu/init | 91 +++++++++++++++++++ .../init-ifupdown/sysmocom-odu/init | 91 +++++++++++++++++++ recipes-extra/ifupdown/files/ifupdown.conf | 1 - recipes-extra/ifupdown/ifupdown_0.7.52.bb | 8 +- 4 files changed, 184 insertions(+), 7 deletions(-) create mode 100644 recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/init create mode 100644 recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-odu/init delete mode 100644 recipes-extra/ifupdown/files/ifupdown.conf diff --git a/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/init b/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/init new file mode 100644 index 0000000..986a2eb --- /dev/null +++ b/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/init @@ -0,0 +1,91 @@ +#!/bin/sh -e +### BEGIN INIT INFO +# Provides: networking +# Required-Start: mountvirtfs $local_fs +# Required-Stop: $local_fs +# Should-Start: ifupdown +# Should-Stop: ifupdown +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Raise network interfaces. +### END INIT INFO + +PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" + +[ -x /sbin/ifup ] || exit 0 + +check_network_file_systems() { + [ -e /proc/mounts ] || return 0 + + if [ -e /etc/iscsi/iscsi.initramfs ]; then + echo "not deconfiguring network interfaces: iSCSI root is mounted." + exit 0 + fi + + exec 9<&0 < /proc/mounts + while read DEV MTPT FSTYPE REST; do + case $DEV in + /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*) + echo "not deconfiguring network interfaces: network devices still mounted." + exit 0 + ;; + esac + case $FSTYPE in + nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs) + echo "not deconfiguring network interfaces: network file systems still mounted." + exit 0 + ;; + esac + done + exec 0<&9 9<&- +} + +check_network_swap() { + [ -e /proc/swaps ] || return 0 + + exec 9<&0 < /proc/swaps + while read DEV MTPT FSTYPE REST; do + case $DEV in + /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*) + echo "not deconfiguring network interfaces: network swap still mounted." + exit 0 + ;; + esac + done + exec 0<&9 9<&- +} + +case "$1" in +start) + echo -n "Configuring network interfaces... " + mkdir /run/network || true + sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 + ifup -a + echo "done." + ;; + +stop) + check_network_file_systems + check_network_swap + + echo -n "Deconfiguring network interfaces... " + ifdown -a + echo "done." + ;; + +force-reload|restart) + echo "Running $0 $1 is deprecated because it may not enable again some interfaces" + echo "Reconfiguring network interfaces... " + ifdown -a || true + ifup -a + echo "done." + ;; + +*) + echo "Usage: /etc/init.d/networking {start|stop}" + exit 1 + ;; +esac + +exit 0 + diff --git a/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-odu/init b/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-odu/init new file mode 100644 index 0000000..986a2eb --- /dev/null +++ b/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-odu/init @@ -0,0 +1,91 @@ +#!/bin/sh -e +### BEGIN INIT INFO +# Provides: networking +# Required-Start: mountvirtfs $local_fs +# Required-Stop: $local_fs +# Should-Start: ifupdown +# Should-Stop: ifupdown +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Raise network interfaces. +### END INIT INFO + +PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" + +[ -x /sbin/ifup ] || exit 0 + +check_network_file_systems() { + [ -e /proc/mounts ] || return 0 + + if [ -e /etc/iscsi/iscsi.initramfs ]; then + echo "not deconfiguring network interfaces: iSCSI root is mounted." + exit 0 + fi + + exec 9<&0 < /proc/mounts + while read DEV MTPT FSTYPE REST; do + case $DEV in + /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*) + echo "not deconfiguring network interfaces: network devices still mounted." + exit 0 + ;; + esac + case $FSTYPE in + nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs) + echo "not deconfiguring network interfaces: network file systems still mounted." + exit 0 + ;; + esac + done + exec 0<&9 9<&- +} + +check_network_swap() { + [ -e /proc/swaps ] || return 0 + + exec 9<&0 < /proc/swaps + while read DEV MTPT FSTYPE REST; do + case $DEV in + /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*) + echo "not deconfiguring network interfaces: network swap still mounted." + exit 0 + ;; + esac + done + exec 0<&9 9<&- +} + +case "$1" in +start) + echo -n "Configuring network interfaces... " + mkdir /run/network || true + sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 + ifup -a + echo "done." + ;; + +stop) + check_network_file_systems + check_network_swap + + echo -n "Deconfiguring network interfaces... " + ifdown -a + echo "done." + ;; + +force-reload|restart) + echo "Running $0 $1 is deprecated because it may not enable again some interfaces" + echo "Reconfiguring network interfaces... " + ifdown -a || true + ifup -a + echo "done." + ;; + +*) + echo "Usage: /etc/init.d/networking {start|stop}" + exit 1 + ;; +esac + +exit 0 + diff --git a/recipes-extra/ifupdown/files/ifupdown.conf b/recipes-extra/ifupdown/files/ifupdown.conf deleted file mode 100644 index 7a7e145..0000000 --- a/recipes-extra/ifupdown/files/ifupdown.conf +++ /dev/null @@ -1 +0,0 @@ -d /run/network - - - - diff --git a/recipes-extra/ifupdown/ifupdown_0.7.52.bb b/recipes-extra/ifupdown/ifupdown_0.7.52.bb index 2b5410a..9114c8d 100644 --- a/recipes-extra/ifupdown/ifupdown_0.7.52.bb +++ b/recipes-extra/ifupdown/ifupdown_0.7.52.bb @@ -7,7 +7,6 @@ LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://debian/copyright;md5=7adfbe801102d1e7e6bfdd3f03754efa" SRC_URI = "https://launchpadlibrarian.net/194033720/ifupdown_${PV}.tar.xz \ - file://ifupdown.conf \ file://busybox-yocto-compat.patch " SRC_URI[md5sum] = "bb204ae2fa4171d6f1de4097f4570a7d" @@ -15,7 +14,7 @@ SRC_URI[sha256sum] = "8a0647c59ee0606f5da9205c5b3c5b000fea98fe39348f6bb2cba5fecf CFLAGS += "-D'IFUPDOWN_VERSION="0.7"'" -PR = "r3" +PR = "r2" do_configure() { chmod a+rx makecdep.sh makenwdep.sh @@ -27,9 +26,6 @@ do_install() { ln -s ${base_sbindir}/ifup.${BPN} ${D}${base_sbindir}/ifdown.${BPN} ln -s ${base_sbindir}/ifup.${BPN} ${D}${base_sbindir}/ifquery install -D -m 0755 settle-dad.sh ${D}/lib/ifupdown/settle-dad.sh - - install -d ${D}${libdir}/tmpfiles.d - install -m 0644 ${WORKDIR}/ifupdown.conf ${D}${libdir}/tmpfiles.d/ } inherit update-alternatives @@ -44,4 +40,4 @@ ALTERNATIVE_TARGET[ifup] = "${base_sbindir}/ifup.${BPN}" ALTERNATIVE_LINK_NAME[ifdown] = "${base_sbindir}/ifdown" ALTERNATIVE_TARGET[ifdown] = "${base_sbindir}/ifdown.${BPN}" -FILES_${PN} += "/lib/ifupdown/settle-dad.sh ${libdir}/tmpfiles.d/*" +FILES_${PN} += "/lib/ifupdown/settle-dad.sh"