diff options
author | Michael Janczyk | 2013-11-06 19:01:33 +0100 |
---|---|---|
committer | Michael Janczyk | 2013-11-06 19:01:33 +0100 |
commit | dc7c90aa941520c7c8a790ffcad007265f7905bf (patch) | |
tree | 7422942a28ce21929c11672c575f85fd0e1dc050 | |
parent | bugfix (diff) | |
download | core-dc7c90aa941520c7c8a790ffcad007265f7905bf.tar.gz core-dc7c90aa941520c7c8a790ffcad007265f7905bf.tar.xz core-dc7c90aa941520c7c8a790ffcad007265f7905bf.zip |
Using IFS as variable for interfaces, very clever ... NOT (IFS = field separator)!
-rw-r--r-- | src/initramfs/distro-specs/centos/functions-default | 10 | ||||
-rw-r--r-- | src/initramfs/distro-specs/rhel/functions-default | 10 | ||||
-rw-r--r-- | src/initramfs/distro-specs/scientific/functions-default | 10 |
3 files changed, 15 insertions, 15 deletions
diff --git a/src/initramfs/distro-specs/centos/functions-default b/src/initramfs/distro-specs/centos/functions-default index bce478bb..e1c98d49 100644 --- a/src/initramfs/distro-specs/centos/functions-default +++ b/src/initramfs/distro-specs/centos/functions-default @@ -60,16 +60,16 @@ config_distro () { #IFACES=$(ip a \ # | grep -B 1 "/ether" \ # | sed -r '/^--$/d;$!N;s#^[0-9]+: ([a-z0-9\.:]+): .*?/ether ([0-9a-fA-F:]+) .*$#\1=\2#') - IFS=$(ip a \ + IFACES=$(ip a \ | awk '/^[0-9]+: /,/ brd /' \ | sed -r '$!N;s,\n,,' \ | grep -o '.*/ether .*' \ | sed -r 's#^[0-9]+: ([a-z0-9\.:]+): .*?/ether ([0-9a-fA-F:]+) .*$#\1=\2#') - for line in $IFS; do - IF=$(echo $line | cut -d= -f1) + for line in $IFACES; do + IFACE=$(echo $line | cut -d= -f1) IFMAC=$(echo $line | cut -d= -f2) - cat << EOF > "/mnt/etc/sysconfig/network-scripts/ifcfg-$IFACE" -DEVICE=$IF + cat << "EOF" > "/mnt/etc/sysconfig/network-scripts/ifcfg-$IFACE" +DEVICE=$IFACE HWADDR=$IFMAC BOOTPROTO=dhcp ONBOOT=no diff --git a/src/initramfs/distro-specs/rhel/functions-default b/src/initramfs/distro-specs/rhel/functions-default index 063a7685..58eb3c47 100644 --- a/src/initramfs/distro-specs/rhel/functions-default +++ b/src/initramfs/distro-specs/rhel/functions-default @@ -60,16 +60,16 @@ config_distro () { #IFACES=$(ip a \ # | grep -B 1 "/ether" \ # | sed -r '/^--$/d;$!N;s#^[0-9]+: ([a-z0-9\.:]+): .*?/ether ([0-9a-fA-F:]+) .*$#\1=\2#') - IFS=$(ip a \ + IFACES=$(ip a \ | awk '/^[0-9]+: /,/ brd /' \ | sed -r '$!N;s,\n,,' \ | grep -o '.*/ether .*' \ | sed -r 's#^[0-9]+: ([a-z0-9\.:]+): .*?/ether ([0-9a-fA-F:]+) .*$#\1=\2#') - for line in $IFS; do - IF=$(echo $line | cut -d= -f1) + for line in $IFACES; do + IFACE=$(echo $line | cut -d= -f1) IFMAC=$(echo $line | cut -d= -f2) - cat << EOF > "/mnt/etc/sysconfig/network-scripts/ifcfg-$IFACE" -DEVICE=$IF + cat << "EOF" > "/mnt/etc/sysconfig/network-scripts/ifcfg-$IFACE" +DEVICE=$IFACE HWADDR=$IFMAC BOOTPROTO=dhcp ONBOOT=no diff --git a/src/initramfs/distro-specs/scientific/functions-default b/src/initramfs/distro-specs/scientific/functions-default index f6cd0adf..da7f52cf 100644 --- a/src/initramfs/distro-specs/scientific/functions-default +++ b/src/initramfs/distro-specs/scientific/functions-default @@ -60,16 +60,16 @@ config_distro () { #IFACES=$(ip a \ # | grep -B 1 "/ether" \ # | sed -r '/^--$/d;$!N;s#^[0-9]+: ([a-z0-9\.:]+): .*?/ether ([0-9a-fA-F:]+) .*$#\1=\2#') - IFS=$(ip a \ + IFACES=$(ip a \ | awk '/^[0-9]+: /,/ brd /' \ | sed -r '$!N;s,\n,,' \ | grep -o '.*/ether .*' \ | sed -r 's#^[0-9]+: ([a-z0-9\.:]+): .*?/ether ([0-9a-fA-F:]+) .*$#\1=\2#') - for line in $IFS; do - IF=$(echo $line | cut -d= -f1) + for line in $IFACES; do + IFACE=$(echo $line | cut -d= -f1) IFMAC=$(echo $line | cut -d= -f2) - cat << EOF > "/mnt/etc/sysconfig/network-scripts/ifcfg-$IFACE" -DEVICE=$IF + cat << "EOF" > "/mnt/etc/sysconfig/network-scripts/ifcfg-$IFACE" +DEVICE=$IFACE HWADDR=$IFMAC BOOTPROTO=dhcp ONBOOT=no |