]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Update scripts to make things a little easier to read
authorVictor Lowther <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Thu, 26 Feb 2009 02:42:07 +0000 (18:42 -0800)
committerHarald Hoyer <harald@redhat.com>
Wed, 4 Mar 2009 15:54:59 +0000 (16:54 +0100)
dhclient-script
ifup

index 0db5921da974b6f35666d31095ef258b8975c230..dce98781a258c1ed9fffaf55c70e6fd0ca146481 100755 (executable)
@@ -16,9 +16,9 @@ case $reason in
        elif [ "$new_domain_name" ]; then
            echo "search $new_domain_name" >> /etc/resolv.conf
        fi
-       (   IFS=",";
-           for s in $new_domain_name_servers; do
-               echo "nameserver $s" >> /etc/resolv.conf
-           done ) ;;
+       for s in $new_domain_name_servers; do
+           echo "nameserver $s" >> /etc/resolv.conf
+       done
+       >/net.$interface.up ;;
     *) ;;
 esac
diff --git a/ifup b/ifup
index cf5828ceea7dbcf402e9751552941afde40c311a..79607db801a966c193b50fb6d0c82f38b1fad7ac 100755 (executable)
--- a/ifup
+++ b/ifup
@@ -1,5 +1,5 @@
 #!/bin/sh
-echo "$*" >>/dev/net-interfaces-found
+>/net.$1
 
 # loopback is always handled the same way
 [ "$1" = "lo" ] && {
@@ -9,12 +9,26 @@ echo "$*" >>/dev/net-interfaces-found
 }
 
 # spin through the kernel command line, looking for ip= lines
-while read p; do
+for p in $(cat /proc/cmdline); do
+    [ "${p%ip=*}" ] || continue
+    p=${p#ip=}
     case $p in
-       'ip=none'|'ip=off') exit 0;; # we were told to not configure anything
-       'ip=dhcp'|'ip=on'|'ip=any') dhclient -nw "$1"; exit 0;; 
-       'ip=bootp'|'ip=rarp'|'ip=both') exit 0;; #dunno how to do this
-       ip=*) exit 0;; #to be written
+       none|off) exit 0;; # we were told to not configure anything
+       dhcp|on|any) dhclient -nw "$1"; exit 0;; 
+       bootp|rarp|both) exit 0;; #dunno how to do this
+       *) echo ${ip#ip=} | \
+           (IFS=':' read client server gw netmask hostname device autoconf
+               if [ -z "$device" -o "$device" = "$1"  ]; then
+                   case $autoconf in
+                       dhcp|on|any) dhclient -nw "$1";;
+                       none|off|'') # do some basic configuration
+                           ip link set $1 up
+                           ip addr add $client/$netmask dev $1
+                           [ "$gw" ] && ip route add default via $gw dev $1
+                           >/net.$1.up ;;
+                   esac
+               fi
+               ) ;;
        *) continue;;
     esac
 done
\ No newline at end of file