ifupdown: Create /run/network through a tmpfiles.d

This way the ifupdown application will not only work
for the IDU/ODU but the BTS, BSC and any other machine
we want to build.

(untested OE modification)
This commit is contained in:
Holger Hans Peter Freyther 2015-04-13 17:41:07 +02:00
parent ba8eee83bd
commit e0c7f3c621
4 changed files with 6 additions and 183 deletions

View File

@ -1,91 +0,0 @@
#!/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

View File

@ -1,91 +0,0 @@
#!/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

View File

@ -0,0 +1 @@
d /run/network - - - -

View File

@ -7,6 +7,7 @@ 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"
@ -14,7 +15,7 @@ SRC_URI[sha256sum] = "8a0647c59ee0606f5da9205c5b3c5b000fea98fe39348f6bb2cba5fecf
CFLAGS += "-D'IFUPDOWN_VERSION="0.7"'"
PR = "r2"
PR = "r3"
do_configure() {
chmod a+rx makecdep.sh makenwdep.sh
@ -26,6 +27,9 @@ 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 ${S}/ifupdown.conf ${D}${libdir}/tmpfiles.d/
}
inherit update-alternatives