[Fai-commit] r6454 - in trunk/examples/simple: hooks scripts/CENTOS

Michael Goetze mgoetze-guest at alioth.debian.org
Fri Apr 15 19:15:44 UTC 2011


Author: mgoetze-guest
Date: 2011-04-15 19:15:36 +0000 (Fri, 15 Apr 2011)
New Revision: 6454

Added:
   trunk/examples/simple/scripts/CENTOS/60-network-scripts
Modified:
   trunk/examples/simple/hooks/prepareapt.CENTOS
Log:
Make static network configuration work on CentOS

Modified: trunk/examples/simple/hooks/prepareapt.CENTOS
===================================================================
--- trunk/examples/simple/hooks/prepareapt.CENTOS	2011-04-15 19:08:56 UTC (rev 6453)
+++ trunk/examples/simple/hooks/prepareapt.CENTOS	2011-04-15 19:15:36 UTC (rev 6454)
@@ -9,26 +9,19 @@
     mount -t sysfs sysfs $target/sys
     cp /etc/mtab $target/etc/mtab
 
-    # Workaround for #588030
-    #cp $target/etc/modprobe.d/modprobe.conf.dist $target/etc/modprobe.conf
-    # Now done with kudzu
-
-    cat > $target/etc/sysconfig/network <<EOF
-NETWORKING=yes
-HOSTNAME=$HOSTNAME
-GATEWAY=$GATEWAYS_1
-EOF
-    cat > $target/etc/hosts <<EOF
-127.0.0.1	localhost
-$IPADDR	$HOSTNAME
-EOF
-    cat > $target/etc/resolv.conf <<EOF
-nameserver $DNSSRVS_1
-EOF
+    cat > $target/etc/sysconfig/network <<-EOF
+		NETWORKING=yes
+		HOSTNAME=$HOSTNAME.$DOMAIN
+		EOF
+    echo "127.0.0.1 localhost" > $target/etc/hosts
+    ifclass DHCPC || ainsl -s $target/etc/hosts "$IPADDR $HOSTNAME.$DOMAIN $HOSTNAME"
+    echo "nameserver $DNSSRVS_1" > $target/etc/resolv.conf
 fi
 
+mkdir $target/dev/pts
+mknod -m 000 $target/dev/pts/ptmx c 5 2
+
 fcopy -riv /etc/yum.repos.d/
-#$ROOTCMD yum groupinstall -y core
 
 skiptask prepareapt
 

Added: trunk/examples/simple/scripts/CENTOS/60-network-scripts
===================================================================
--- trunk/examples/simple/scripts/CENTOS/60-network-scripts	                        (rev 0)
+++ trunk/examples/simple/scripts/CENTOS/60-network-scripts	2011-04-15 19:15:36 UTC (rev 6454)
@@ -0,0 +1,30 @@
+#! /bin/bash
+
+# (c) Michael Goetze, 2011, mgoetze at mgoetze.net
+
+error=0 ; trap "error=$((error|1))" ERR
+
+# Note: Kudzu will automatically configure eth0 for DHCP
+if [ $FAI_ACTION != "softupdate" ] && ! ifclass DHCPC
+then
+	ainsl -v $target/etc/sysconfig/network "^GATEWAY=$GATEWAYS_1\$"
+	[ -n "$IPADDR" ] && cat > $target/etc/sysconfig/network-scripts/ifcfg-eth0 <<-EOF
+		# generated by FAI
+		DEVICE=eth0
+		BOOTPROTO=static
+		ONBOOT=yes
+		HWADDR=`ip l s dev eth0 | tail -1 | cut -d" " -f6`
+		IPADDR=$IPADDR
+		NETMASK=$NETMASK
+	EOF
+    # Kudzu for some reason won't write eth0 into /etc/sysconfig/hwconf
+    # from within the chroot. The following hack puts it in there
+    # so that Kudzu doesn't overwrite our config on first boot.
+    grep eth0 $target/etc/sysconfig/hwconf || $ROOTCMD kudzu -c NETWORK -p \
+        >> $target/etc/sysconfig/hwconf
+fi
+
+fcopy -iv /etc/sysconfig/network /etc/resolv.conf /etc/networks
+fcopy -ivr /etc/sysconfig/network-scripts
+
+exit $error


Property changes on: trunk/examples/simple/scripts/CENTOS/60-network-scripts
___________________________________________________________________
Added: svn:executable
   + *




More information about the Fai-commit mailing list