]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
move fix_bootif to net-lib
authorWill Woods <wwoods@redhat.com>
Wed, 22 Aug 2012 16:57:43 +0000 (12:57 -0400)
committerHarald Hoyer <harald@redhat.com>
Thu, 13 Jun 2013 11:54:16 +0000 (13:54 +0200)
This might be useful to other parts of dracut; move it to net-lib.sh.

modules.d/40network/net-genrules.sh
modules.d/40network/net-lib.sh

index 8f28c93ea68f37d7748acdb5022a542fd180932f..f4b1f88c0c4789e6bfe90eb3ce936b1a4a3780dc 100755 (executable)
@@ -2,18 +2,6 @@
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
-# pxelinux provides macaddr '-' separated, but we need ':'
-fix_bootif() {
-    local macaddr=${1}
-    local IFS='-'
-    macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
-    macaddr=${macaddr%:}
-    # strip hardware type field from pxelinux
-    [ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
-    # return macaddr with lowercase alpha characters expected by udev
-    echo $macaddr | sed 'y/ABCDEF/abcdef/'
-}
-
 getargbool 0 rd.neednet && NEEDNET=1
 
 # Don't continue if we don't need network
@@ -21,6 +9,8 @@ if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && [ "$NEEDNET" != "1" ]; the
     return
 fi
 
+command -v fix_bootif >/dev/null || . /lib/net-lib.sh
+
 # Write udev rules
 {
     # bridge: attempt only the defined interface
index f8288bbfe960dacd0e6ed3095376003e86565406..056fbc924c53317a1967e606ac752d4c3ddee66c 100644 (file)
@@ -139,6 +139,18 @@ set_ifname() {
     echo "$name$num"
 }
 
+# pxelinux provides macaddr '-' separated, but we need ':'
+fix_bootif() {
+    local macaddr=${1}
+    local IFS='-'
+    macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
+    macaddr=${macaddr%:}
+    # strip hardware type field from pxelinux
+    [ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
+    # return macaddr with lowercase alpha characters expected by udev
+    echo $macaddr | sed 'y/ABCDEF/abcdef/'
+}
+
 ibft_to_cmdline() {
     local iface="" mac="" dev=""
     local dhcp="" ip="" gw="" mask="" hostname=""