[Fai-commit] r5429 - in trunk: bin debian examples/simple/files/etc/rc2.d/S99fai-setup lib

Thomas Lange lange at alioth.debian.org
Sat Jul 18 16:29:14 UTC 2009


Author: lange
Date: 2009-07-18 16:29:12 +0000 (Sat, 18 Jul 2009)
New Revision: 5429

Modified:
   trunk/bin/fai-setup
   trunk/bin/make-fai-nfsroot
   trunk/debian/changelog
   trunk/debian/control
   trunk/examples/simple/files/etc/rc2.d/S99fai-setup/FAISERVER
   trunk/lib/get-boot-info
   trunk/lib/subroutines-linux
   trunk/lib/task_sysinfo
Log:
* debian/control: Depends: iproute for fai-client, fai-server
* fai-setup, make-fai-nfsroot, subroutine-linux, get-boot-info,
  task_sysinfo, S99fai-setup/FAISERVER: Replaced all calls to ifconfig
  by proper ip + shell magic calls (closes: #524347). Thanks to Luk
  Claes for the patch

Modified: trunk/bin/fai-setup
===================================================================
--- trunk/bin/fai-setup	2009-07-18 16:26:57 UTC (rev 5428)
+++ trunk/bin/fai-setup	2009-07-18 16:29:12 UTC (rev 5429)
@@ -115,7 +115,7 @@
 	    [ -f /etc/ssh/ssh_host_dsa_key.pub ] && DSASERVER=$(sed -e "s/= .*$/=/" /etc/ssh/ssh_host_dsa_key.pub)
 	    [ -f /etc/ssh/ssh_host_rsa_key.pub ] && RSASERVER=$(sed -e "s/= .*$/=/" /etc/ssh/ssh_host_rsa_key.pub )
 	    # determine all IP addresses, and their host names
-	    ips=$(LC_ALL=C ifconfig| perl -ne '/addr:([\d.]+)/ && print"$1\n"'|grep -v 127.0.0.1)
+	    ips=$(ip addr | grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | grep -v 127.0.0.1)
 	    for ip in $ips; do
 		hname=$(getent hosts $ip| tr -s ' ' ',')
 		[ -z "$hname" ] && hname=$ip
@@ -176,13 +176,12 @@
     test -f /etc/init.d/nfs-kernel-server && nfsserver=nfs-kernel-server
     test -f /etc/init.d/nfs-user-server && nfsserver=nfs-user-server
 
-    addr=$(LC_ALL=C ifconfig $SERVERINTERFACE | grep -v 127.0.0.1 | perl -ne '/addr:([\d.]+)/ && print"$1\n"'|head -1)
-    mask=$(LC_ALL=C ifconfig $SERVERINTERFACE | grep -v 127.0.0.1 | perl -ne '/Mask:([\d.]+)/ && print"$1\n"'|head -1)
+    addr=$(ip addr show dev $SERVERINTERFACE | grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | cut -d / -f 1 | grep -v 127.0.0.1 | head -1)
 
     if expr match "$FAI_CONFIG_SRC" 'nfs:\/\/' > /dev/null; then
-        add_export_line $FAI_CONFIGDIR  "$addr/$mask(async,ro,no_subtree_check)"
+        add_export_line $FAI_CONFIGDIR  "$addr(async,ro,no_subtree_check)"
     fi
-    add_export_line $NFSROOT  "$addr/$mask(async,ro,no_subtree_check,no_root_squash)"
+    add_export_line $NFSROOT  "$addr(async,ro,no_subtree_check,no_root_squash)"
     if [ -z "$nfsserver" ]; then
 	echo "Could not find the type of your nfs server. Maybe"
 	echo "no nfs server is installed. I can't restart it."

Modified: trunk/bin/make-fai-nfsroot
===================================================================
--- trunk/bin/make-fai-nfsroot	2009-07-18 16:26:57 UTC (rev 5428)
+++ trunk/bin/make-fai-nfsroot	2009-07-18 16:29:12 UTC (rev 5429)
@@ -262,7 +262,7 @@
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 add_all_host_entries() {
 
-    local ips=$(ifconfig | grep -w inet | cut -d : -f 2 | cut -d ' ' -f 1 | grep -v 127.0.0.1)
+    local ips=$(ip addr | grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | cut -d / -f 1 | grep -v 127.0.0.1)
     for eth in $ips; do
 	getent hosts $eth >> etc/hosts || true
     done

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2009-07-18 16:26:57 UTC (rev 5428)
+++ trunk/debian/changelog	2009-07-18 16:29:12 UTC (rev 5429)
@@ -10,9 +10,14 @@
     line (closes: #497548)
   * ainsl: create missing path elements if -a is used (closes: #447199)
   * make-fai-nfsroot: mount sysfs inside nfsroot (closes: #532985)
+  * debian/control: Depends: iproute for fai-client, fai-server
+  * fai-setup, make-fai-nfsroot, subroutine-linux, get-boot-info,
+    task_sysinfo, S99fai-setup/FAISERVER: Replaced all calls to ifconfig
+    by proper ip + shell magic calls (closes: #524347). Thanks to Luk
+    Claes for the patch
+  
+ -- Thomas Lange <lange at debian.org>  Sat, 18 Jul 2009 18:26:02 +0200
 
- -- Thomas Lange <lange at debian.org>  Sat, 18 Jul 2009 17:42:32 +0200
-
 fai (3.2.20) unstable; urgency=low
 
   [ Thomas Lange ]

Modified: trunk/debian/control
===================================================================
--- trunk/debian/control	2009-07-18 16:26:57 UTC (rev 5428)
+++ trunk/debian/control	2009-07-18 16:29:12 UTC (rev 5429)
@@ -12,7 +12,7 @@
 
 Package: fai-client
 Architecture: all
-Depends: perl, file, libapt-pkg-perl, libparse-recdescent-perl, liblinux-lvm-perl, net-tools
+Depends: perl, file, libapt-pkg-perl, libparse-recdescent-perl, liblinux-lvm-perl, iproute
 Recommends: debconf-utils, cfengine2
 Suggests: ntfsprogs, dmsetup, cryptsetup
 Conflicts: fai, fai-kernels
@@ -42,7 +42,7 @@
 Package: fai-server
 Architecture: all
 Depends: fai-client, debootstrap
-Recommends: nfs-kernel-server, dhcp3-server | bootp, tftpd-hpa | tftpd, openssh-server, openssh-client, syslinux-common, openbsd-inetd | inet-superserver
+Recommends: nfs-kernel-server, dhcp3-server | bootp, tftpd-hpa | tftpd, openssh-server, openssh-client, syslinux-common, openbsd-inetd | inet-superserver, iproute
 Suggests: debmirror, apt-move, genisoimage, grub, aptitude, perl-tk, libproc-daemon-perl
 Conflicts: fai
 Replaces: fai

Modified: trunk/examples/simple/files/etc/rc2.d/S99fai-setup/FAISERVER
===================================================================
--- trunk/examples/simple/files/etc/rc2.d/S99fai-setup/FAISERVER	2009-07-18 16:26:57 UTC (rev 5428)
+++ trunk/examples/simple/files/etc/rc2.d/S99fai-setup/FAISERVER	2009-07-18 16:29:12 UTC (rev 5429)
@@ -13,7 +13,7 @@
 
 # setup network
 dhclient eth0  # connection to the outside world (hopefully)
-ifconfig eth0:1 192.168.1.250 # (fixed address of faiserver)
+ip addr add 192.168.1.250 dev eth0 # (fixed address of faiserver)
 /etc/init.d/nscd restart
 /etc/init.d/apache2 restart
 /etc/init.d/apt-proxy restart

Modified: trunk/lib/get-boot-info
===================================================================
--- trunk/lib/get-boot-info	2009-07-18 16:26:57 UTC (rev 5428)
+++ trunk/lib/get-boot-info	2009-07-18 16:29:12 UTC (rev 5429)
@@ -41,14 +41,14 @@
 netdevice_info() {
 
     # devices that are running
-    netdevices_up=$(ifconfig | perl -anF'\s+' -e 'print "$F[0]\n" if $F[0];' | grep -v "^lo" | sort | uniq)
+    netdevices_up=$(ip link | grep "^[1-9$]" | cut -d : -f 2 | cut -d ' ' -f 2 | grep -v "^lo" | sort | uniq)
     # netdevices is the list of ethernet devices which will be used for bootpc (maybe dhcp)
     # if not defined, use boot messages to determine network devices
     [ -n "$netdevices" ] || netdevices=$netdevices_up
 
     # some network driver do not echo eth0,..; they are not detected
     netdevices_all=$(dmesg| perl -ne 'print $&,"\n" if m/\beth[0-9]\b/')
-    tmp=$(ifconfig -a | awk '/^eth/ { print $1 }')
+    tmp=$(ip link | grep "^[1-9]" | cut -d : -f 2 | cut -d ' ' -f 2 | grep "^eth")
     netdevices_all="$netdevices_all $tmp"
     netdevices_all=$(for dev in $netdevices_all; do echo $dev; done| sort | uniq)
 

Modified: trunk/lib/subroutines-linux
===================================================================
--- trunk/lib/subroutines-linux	2009-07-18 16:26:57 UTC (rev 5428)
+++ trunk/lib/subroutines-linux	2009-07-18 16:29:12 UTC (rev 5429)
@@ -271,7 +271,7 @@
 
     if [ $do_init_tasks -eq 1 ] ; then
 	# show some local information
-	ifconfig; df
+	ip addr; df
 	# umount swap space
 	swapoff -a
     fi

Modified: trunk/lib/task_sysinfo
===================================================================
--- trunk/lib/task_sysinfo	2009-07-18 16:26:57 UTC (rev 5428)
+++ trunk/lib/task_sysinfo	2009-07-18 16:29:12 UTC (rev 5429)
@@ -26,7 +26,7 @@
 lsusb
 echo "Ethernet cards found: $netdevices_all"
 echo "Ethernet cards running: $netdevices_up"
-ifconfig -a
+ip addr
 
 [ -x "$(which sysinfo)" ] && sysinfo -class device -level all
 




More information about the Fai-commit mailing list