use ip instead of ifconfig if available (bnc#479009)
authorLudwig Nussel <ludwig.nussel@suse.de>
Wed, 9 Dec 2009 16:30:43 +0000 (17:30 +0100)
committerLudwig Nussel <ludwig.nussel@suse.de>
Wed, 9 Dec 2009 16:41:49 +0000 (17:41 +0100)
build

diff --git a/build b/build
index 6536774..bfd4b57 100755 (executable)
--- a/build
+++ b/build
@@ -1437,8 +1437,17 @@ for SPECFILE in "${SPECFILES[@]}" ; do
     fi
     echo -----------------------------------------------------------------
     echo -----------------------------------------------------------------
-    test -n "$RUNNING_IN_VM" && ifconfig lo 127.0.0.1 up
-    test -n "$RUNNING_IN_VM" -a -n "$MYHOSTNAME" && hostname "$MYHOSTNAME"
+    if [ -n "$RUNNING_IN_VM" ]; then
+       if [ -x /sbin/ip ]; then
+           ip addr add 127.0.0.1/8 dev lo
+           ip link set lo up
+       else
+           ifconfig lo 127.0.0.1 up
+       fi
+       if [ -n "$MYHOSTNAME" ]; then
+           hostname "$MYHOSTNAME"
+       fi
+    fi
 
     BUILD_SUCCEEDED=false