summaryrefslogtreecommitdiffstats
path: root/snippets/post_install_network_config
diff options
context:
space:
mode:
authorJasper Capel <jasper@newnewyork.nl>2008-11-19 23:12:54 +0100
committerJasper Capel <jasper@newnewyork.nl>2008-11-19 23:12:54 +0100
commitb24fd4f6c965127fafe183add69b99fe75109a8e (patch)
tree55a3ffa45d4e7d26a15811150e9cb56556d28fae /snippets/post_install_network_config
parentce29df8950827c4f8821bb19f1947748a47047db (diff)
downloadcobbler-b24fd4f6c965127fafe183add69b99fe75109a8e.tar.gz
cobbler-b24fd4f6c965127fafe183add69b99fe75109a8e.tar.xz
cobbler-b24fd4f6c965127fafe183add69b99fe75109a8e.zip
Stage the new network configuration in a tmp-directory first.
Diffstat (limited to 'snippets/post_install_network_config')
-rw-r--r--snippets/post_install_network_config12
1 files changed, 8 insertions, 4 deletions
diff --git a/snippets/post_install_network_config b/snippets/post_install_network_config
index e203b063..f1173c1e 100644
--- a/snippets/post_install_network_config
+++ b/snippets/post_install_network_config
@@ -25,6 +25,8 @@
#if $numbondingdevs > 0
echo "options bonding max_bonds=$numbondingdevs" >> /etc/modprobe.conf
#end if
+mkdir /etc/sysconfig/network-scripts/cobbler
+cp /etc/sysconfig/network-scripts/ifcfg-lo /etc/sysconfig/network-scripts/cobbler/
#for $iname in $ikeys
# Start $iname
#set $idata = $interfaces[$iname]
@@ -37,7 +39,7 @@ echo "options bonding max_bonds=$numbondingdevs" >> /etc/modprobe.conf
#set $bonding_master = $idata["bonding_master"]
#set $bonding_opts = $idata["bonding_opts"]
#set $ihostname = $idata["hostname"]
- #set $devfile = "/etc/sysconfig/network-scripts/ifcfg-" + $iname
+ #set $devfile = "/etc/sysconfig/network-scripts/cobbler/ifcfg-" + $iname
#if $vlanpattern.match($iname)
## If this is a VLAN interface, skip it, anaconda doesn't know
## about VLANs.
@@ -56,7 +58,6 @@ IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d ' ' -f 1)
## Rename this interface in modprobe.conf
sed -i "s/\$IFNAME/$iname/" /etc/modprobe.conf
## Remove the old interface file the OS had for it
-rm -f /etc/sysconfig/network-scripts/ifcfg-\$IFNAME
echo "DEVICE=$iname" > $devfile
echo "ONBOOT=yes" >> $devfile
#if $bonding.lower() == "slave" and $bonding_master != ""
@@ -132,12 +133,15 @@ sed -i "s/$curiname/$iname/" /etc/modprobe.conf
(
grep -v "DEVICE=" /etc/sysconfig/network-scripts/ifcfg-$curiname
echo "DEVICE=$iname"
-) > /etc/sysconfig/network-scripts/ifcfg-$iname
-rm -f /etc/sysconfig/network-scripts/ifcfg-$curiname
+) > /etc/sysconfig/network-scripts/cobbler/ifcfg-$iname
#end if
#end if
#set $i = $i + 1
# End $iname
#end for
+## Move all staged files to their final location
+rm -f /etc/sysconfig/network-scripts/ifcfg-*
+mv /etc/sysconfig/network-scripts/cobbler/* /etc/sysconfig/network-scripts/
+rm -r /etc/sysconfig/network-scripts/cobbler
#end if
# End post_install_network_config generated code