From a4ea304034ae5c85ab496e5d6f0e89cd0e007766 Mon Sep 17 00:00:00 2001 From: Alex Gonzalez Date: Mon, 14 Jan 2013 18:42:27 +0100 Subject: [PATCH] meta-digi-del: Append netbase to customize startup scripts. Add custom /etc/init.d/networking and /etc/network/interfaces. The networking script does the start section on the background which inlcudes the bringing up of the interfaces. In this way DHCP does not delay the boot up. The interfaces file configures the wireless interface to be automatically brought up. Signed-off-by: Alex Gonzalez --- .../recipes-core/netbase/netbase-5.0/init | 93 +++++++++++++++++++ .../netbase/netbase-5.0/interfaces | 32 +++++++ .../recipes-core/netbase/netbase_5.0.bbappend | 3 + 3 files changed, 128 insertions(+) create mode 100644 meta-digi-del/recipes-core/netbase/netbase-5.0/init create mode 100644 meta-digi-del/recipes-core/netbase/netbase-5.0/interfaces create mode 100644 meta-digi-del/recipes-core/netbase/netbase_5.0.bbappend diff --git a/meta-digi-del/recipes-core/netbase/netbase-5.0/init b/meta-digi-del/recipes-core/netbase/netbase-5.0/init new file mode 100644 index 000000000..c0933e883 --- /dev/null +++ b/meta-digi-del/recipes-core/netbase/netbase-5.0/init @@ -0,0 +1,93 @@ +#!/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<&- +} + +start_on_boot() { + echo -n "Configuring network interfaces... " + ifup -a + echo "done." +} + +case "$1" in +start) + start_on_boot & + ;; + +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/meta-digi-del/recipes-core/netbase/netbase-5.0/interfaces b/meta-digi-del/recipes-core/netbase/netbase-5.0/interfaces new file mode 100644 index 000000000..2d3b12bcc --- /dev/null +++ b/meta-digi-del/recipes-core/netbase/netbase-5.0/interfaces @@ -0,0 +1,32 @@ +# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) + +# The loopback interface +auto lo +iface lo inet loopback + +# Wireless interfaces +auto wlan0 +iface wlan0 inet dhcp + wireless_mode managed + wireless_essid any + wpa-driver wext + wpa-conf /etc/wpa_supplicant.conf + +iface atml0 inet dhcp + +# Wired or wireless interfaces +auto eth0 +iface eth0 inet dhcp +iface eth1 inet dhcp + +# Ethernet/RNDIS gadget (g_ether) +# ... or on host side, usbnet and random hwaddr +iface usb0 inet static + address 192.168.7.2 + netmask 255.255.255.0 + network 192.168.7.0 + gateway 192.168.7.1 + +# Bluetooth networking +iface bnep0 inet dhcp + diff --git a/meta-digi-del/recipes-core/netbase/netbase_5.0.bbappend b/meta-digi-del/recipes-core/netbase/netbase_5.0.bbappend new file mode 100644 index 000000000..332a21f91 --- /dev/null +++ b/meta-digi-del/recipes-core/netbase/netbase_5.0.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:" + +PR_append = "+${DISTRO}.r0"