3 # Purpose: scan for Debian-style network configs and enable it on the system
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under GPL v2+.
7 ################################################################################
9 . /etc/grml/lsb-functions
11 if [ "$1" = "-h" -o "$1" = "--help" ] ; then
13 echo "Looks for /etc/network/interfaces on all volumes and uses it to"
14 echo "configure the running system."
15 echo "WARNING: The networking subsystem will be restarted."
19 DEVICES="$(< /proc/partitions tail -n +3 | awk '{print "/dev/"$4}' | tr "\n" " ")"
20 DEVICES="$DEVICES $(ls /dev/mapper/*)"
24 if ! mount | grep '/mnt ' >/dev/null 2>&1 ; then
26 if mount -o ro -t auto "$i" /mnt >/dev/null 2>&1; then
27 einfo "Scanning on $i"
28 if [ -f /mnt/etc/network/interfaces ]; then
29 einfo "/etc/network/interfaces found on ${i}" ; eend 0
37 if [ -n "$FOUND_DEBNET" ]; then
38 einfo "Stopping network."
39 pump -k >/dev/null 2>&1
40 /etc/init.d/networking stop >/dev/null 2>&1 ; eend $?
41 einfo "Copying Debian network configuration from $FOUND_DEBNET to running system."
42 rm -rf /etc/network/run
43 cp -a /mnt/etc/network /etc
44 rm -rf /etc/network/run
45 mkdir /etc/network/run
47 einfo "Starting network."
48 invoke-rc.d networking start ; eend $?
50 eerror "/etc/network/interfaces not found on external partitions." ; eend 1
54 eerror "Error: /mnt already mounted." ; eend 1