diff options
author | Will Woods <wwoods@redhat.com> | 2012-08-22 12:57:43 -0400 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2013-06-13 13:54:16 +0200 |
commit | 215ff169dbf01c6175840c8e69d50b9b960dc1a7 (patch) | |
tree | 27d6c6894c4085634e2361da99b45f6358f25ff9 /modules.d | |
parent | 85b458d90dd67f75b5d0fad6d50488f1348a3983 (diff) | |
download | dracut-215ff169dbf01c6175840c8e69d50b9b960dc1a7.tar.gz dracut-215ff169dbf01c6175840c8e69d50b9b960dc1a7.tar.bz2 dracut-215ff169dbf01c6175840c8e69d50b9b960dc1a7.zip |
move fix_bootif to net-lib
This might be useful to other parts of dracut; move it to net-lib.sh.
Diffstat (limited to 'modules.d')
-rwxr-xr-x | modules.d/40network/net-genrules.sh | 14 | ||||
-rw-r--r-- | modules.d/40network/net-lib.sh | 12 |
2 files changed, 14 insertions, 12 deletions
diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh index 8f28c93e..f4b1f88c 100755 --- a/modules.d/40network/net-genrules.sh +++ b/modules.d/40network/net-genrules.sh @@ -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 diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh index f8288bbf..056fbc92 100644 --- a/modules.d/40network/net-lib.sh +++ b/modules.d/40network/net-lib.sh @@ -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="" |