X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=sbin%2Fdebnet;h=fcee25baf160fab41bd659aeb5b49d2b3d7d1b7f;hb=50d677811edb91fa240651d913ea3c779ea3c387;hp=36376f9d9ed887e17c9d5110afc56fa2d5efb769;hpb=b11f6b3f4f7954e997a3013ee3382cd2db4ee457;p=grml-network.git diff --git a/sbin/debnet b/sbin/debnet index 36376f9..fcee25b 100755 --- a/sbin/debnet +++ b/sbin/debnet @@ -1,9 +1,9 @@ #!/bin/sh -e # Filename: debnet -# Purpose: scan for Debian-style network configs and enables it on the system +# Purpose: scan for Debian-style network configs and enable it on the system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2. +# License: This file is licensed under GPL v2+. ################################################################################ . /etc/grml/lsb-functions @@ -16,27 +16,26 @@ if [ "$1" = "-h" -o "$1" = "--help" ] ; then exit 0 fi -DEVICES="$(< /proc/partitions tail -n +3 | awk '{print "/dev/"$4}' | tr "\n" " ")" +DEVICES="$(< /proc/partitions tail -n +3 | awk '($4 !~ /loop[0-9]+/) {print "/dev/"$4}' | tr "\n" " ")" DEVICES="$DEVICES $(ls /dev/mapper/*)" FOUND_DEBNET="" eindent if ! mount | grep '/mnt ' >/dev/null 2>&1 ; then - for i in $DEVICES; do - if mount -o ro -t auto "$i" /mnt >/dev/null 2>&1; then - einfo "Scanning on $i" - if [ -f /mnt/etc/network/interfaces ]; then - einfo "/etc/network/interfaces found on ${i}" ; eend 0 - FOUND_DEBNET="$i" - break - fi - umount /mnt - fi - done + for i in $DEVICES; do + if mount -o ro -t auto "$i" /mnt >/dev/null 2>&1; then + einfo "Scanning on $i" + if [ -f /mnt/etc/network/interfaces ]; then + einfo "/etc/network/interfaces found on ${i}" ; eend 0 + FOUND_DEBNET="$i" + break + fi + umount /mnt + fi + done if [ -n "$FOUND_DEBNET" ]; then einfo "Stopping network." - pump -k >/dev/null 2>&1 /etc/init.d/networking stop >/dev/null 2>&1 ; eend $? einfo "Copying Debian network configuration from $FOUND_DEBNET to running system." rm -rf /etc/network/run @@ -47,7 +46,7 @@ if ! mount | grep '/mnt ' >/dev/null 2>&1 ; then einfo "Starting network." invoke-rc.d networking start ; eend $? else - eerror "/etc/network/interfaces not found." ; eend 1 + eerror "/etc/network/interfaces not found on external partitions." ; eend 1 fi eoutdent else