[Fai-commit] r6288 - in trunk/examples/simple: class disk_config files/etc files/etc/selinux files/etc/selinux/config hooks package_config scripts scripts/CENTOS scripts/LAST

Michael Goetze mgoetze-guest at alioth.debian.org
Fri Feb 11 10:38:00 UTC 2011


Author: mgoetze-guest
Date: 2011-02-11 10:37:54 +0000 (Fri, 11 Feb 2011)
New Revision: 6288

Added:
   trunk/examples/simple/class/CENTOS.var
   trunk/examples/simple/disk_config/CENTOS
   trunk/examples/simple/files/etc/selinux/
   trunk/examples/simple/files/etc/selinux/config/
   trunk/examples/simple/files/etc/selinux/config/CENTOS
   trunk/examples/simple/hooks/debconf.CENTOS
   trunk/examples/simple/hooks/prepareapt.CENTOS
   trunk/examples/simple/hooks/updatebase.CENTOS
   trunk/examples/simple/package_config/CENTOS
   trunk/examples/simple/scripts/CENTOS/
   trunk/examples/simple/scripts/CENTOS/10-security
   trunk/examples/simple/scripts/CENTOS/20-mknod
   trunk/examples/simple/scripts/CENTOS/30-mkinitrd
   trunk/examples/simple/scripts/CENTOS/40-install-grub
   trunk/examples/simple/scripts/CENTOS/90-cleanup
Modified:
   trunk/examples/simple/class/50-host-classes
   trunk/examples/simple/scripts/LAST/50-misc
Log:
Initial checkin of CentOS support for simple examples.
Note: this currently depends on a device2grub patch which has been
proposed on linux-fai-devel but not yet committed to trunk.


Modified: trunk/examples/simple/class/50-host-classes
===================================================================
--- trunk/examples/simple/class/50-host-classes	2011-02-11 10:29:34 UTC (rev 6287)
+++ trunk/examples/simple/class/50-host-classes	2011-02-11 10:37:54 UTC (rev 6288)
@@ -16,6 +16,11 @@
 	echo "FAIBASE DEBIAN DHCPC LVM_XEN_SERVER XEN" ;;
     puma)
 	echo "FAIBASE DEBIAN DHCPC RAID_XEN_VIRTUAL" ;;
+    centos)
+	echo "FAIBASE CENTOS"
+	ifclass I386 && echo CENTOS5_32
+	ifclass AMD64 && echo CENTOS5_64
+	exit 0 ;; # CentOS does not use the GRUB class
     *)
 	echo "FAIBASE DEBIAN DHCPC" ;;
 esac

Added: trunk/examples/simple/class/CENTOS.var
===================================================================
--- trunk/examples/simple/class/CENTOS.var	                        (rev 0)
+++ trunk/examples/simple/class/CENTOS.var	2011-02-11 10:37:54 UTC (rev 6288)
@@ -0,0 +1 @@
+FAI_RAMDISKS="$target/var/lib/rpm $target/var/cache/yum"

Added: trunk/examples/simple/disk_config/CENTOS
===================================================================
--- trunk/examples/simple/disk_config/CENTOS	                        (rev 0)
+++ trunk/examples/simple/disk_config/CENTOS	2011-02-11 10:37:54 UTC (rev 6288)
@@ -0,0 +1,14 @@
+# example of new config file for setup-storage
+#
+# <type> <mountpoint> <size>   <fs type> <mount options> <misc options>
+
+disk_config disk1 disklabel:msdos bootable:1 fstabkey:label
+
+# Note that the CentOS 5 version of GRUB cannot read from ext3 filesystems
+# with inode_size > 128
+primary /      350      ext3  rw,noatime,errors=remount-ro createopts="-L ROOT -I 128"
+logical swap   200-1000 swap  rw                           createopts="-L SWAP"
+logical /var   600-1300 ext3  rw,noatime                   createopts="-L VAR -m 5" tuneopts="-c 0 -i 0"
+logical /tmp   100-1G   ext3  rw,noatime,nosuid,nodev      createopts="-L TMP -m 0" tuneopts="-c 0 -i 0"
+logical /usr   1G-8G    ext3  rw,noatime,nodev             createopts="-L USR"
+logical /home  100-50%  ext3  rw,noatime,nosuid,nodev      createopts="-L HOME -m 1" tuneopts="-c 0 -i 0"

Added: trunk/examples/simple/files/etc/selinux/config/CENTOS
===================================================================
--- trunk/examples/simple/files/etc/selinux/config/CENTOS	                        (rev 0)
+++ trunk/examples/simple/files/etc/selinux/config/CENTOS	2011-02-11 10:37:54 UTC (rev 6288)
@@ -0,0 +1,14 @@
+# This file controls the state of SELinux on the system.
+# SELINUX= can take one of these three values:
+#       enforcing - SELinux security policy is enforced.
+#       permissive - SELinux prints warnings instead of enforcing.
+#       disabled - No SELinux policy is loaded.
+SELINUX=disabled
+# SELINUXTYPE= can take one of these two values:
+#       targeted - Only targeted network daemons are protected.
+#       strict - Full SELinux protection.
+#       mls - Multi Level Security protection.
+SELINUXTYPE=targeted
+# SETLOCALDEFS= Check local definition changes
+SETLOCALDEFS=0
+

Added: trunk/examples/simple/hooks/debconf.CENTOS
===================================================================
--- trunk/examples/simple/hooks/debconf.CENTOS	                        (rev 0)
+++ trunk/examples/simple/hooks/debconf.CENTOS	2011-02-11 10:37:54 UTC (rev 6288)
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+skiptask debconf


Property changes on: trunk/examples/simple/hooks/debconf.CENTOS
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/examples/simple/hooks/prepareapt.CENTOS
===================================================================
--- trunk/examples/simple/hooks/prepareapt.CENTOS	                        (rev 0)
+++ trunk/examples/simple/hooks/prepareapt.CENTOS	2011-02-11 10:37:54 UTC (rev 6288)
@@ -0,0 +1,35 @@
+#! /bin/bash
+
+# (c) Michael Goetze, 2010-2011, mgoetze at mgoetze.net
+
+error=0 ; trap "error=$((error|1))" ERR
+
+if [ $FAI_ACTION = "install" ]; then
+    mount -t proc proc $target/proc
+    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
+fi
+
+fcopy -riv /etc/yum.repos.d/
+#$ROOTCMD yum groupinstall -y core
+
+skiptask prepareapt
+
+exit $error


Property changes on: trunk/examples/simple/hooks/prepareapt.CENTOS
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/examples/simple/hooks/updatebase.CENTOS
===================================================================
--- trunk/examples/simple/hooks/updatebase.CENTOS	                        (rev 0)
+++ trunk/examples/simple/hooks/updatebase.CENTOS	2011-02-11 10:37:54 UTC (rev 6288)
@@ -0,0 +1,10 @@
+#! /bin/bash
+
+if [ "$verbose" ]; then
+	echo "Updating base"
+	$ROOTCMD yum update 2>&1 | tee -a $LOGDIR/software.log
+else
+	$ROOTCMD yum update >> $LOGDIR/software.log
+fi
+
+skiptask updatebase


Property changes on: trunk/examples/simple/hooks/updatebase.CENTOS
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/examples/simple/package_config/CENTOS
===================================================================
--- trunk/examples/simple/package_config/CENTOS	                        (rev 0)
+++ trunk/examples/simple/package_config/CENTOS	2011-02-11 10:37:54 UTC (rev 6288)
@@ -0,0 +1,17 @@
+PACKAGES yumgroup
+core
+
+PACKAGES yumi
+kernel
+grub
+less
+openssh
+openssh-clients
+openssh-server
+vim-enhanced
+man
+wget
+screen
+unzip
+which
+nfs-utils

Added: trunk/examples/simple/scripts/CENTOS/10-security
===================================================================
--- trunk/examples/simple/scripts/CENTOS/10-security	                        (rev 0)
+++ trunk/examples/simple/scripts/CENTOS/10-security	2011-02-11 10:37:54 UTC (rev 6288)
@@ -0,0 +1,13 @@
+#! /bin/bash
+
+# (c) Michael Goetze, 2010-11, mgoetze at mgoetze.net
+
+error=0 ; trap "error=$((error|1))" ERR
+
+$ROOTCMD authconfig --enableshadow --enablemd5 \
+	--enablelocauthorize --updateall
+echo "root:$ROOTPW" | $ROOTCMD chpasswd --encrypted
+
+fcopy -v /etc/selinux/config
+
+exit $error


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

Added: trunk/examples/simple/scripts/CENTOS/20-mknod
===================================================================
--- trunk/examples/simple/scripts/CENTOS/20-mknod	                        (rev 0)
+++ trunk/examples/simple/scripts/CENTOS/20-mknod	2011-02-11 10:37:54 UTC (rev 6288)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+# (c) Michael Goetze, 2010-2011, mgoetze at mgoetze.net
+
+mknod -m 600 $target/dev/hda b 3 0
+mknod -m 600 $target/dev/sda b 8 0
+for x in `seq 1 15`; do
+    mknod -m 600 $target/dev/hda$x b 3 $x
+    mknod -m 600 $target/dev/sda$x b 8 $x
+done
+mknod -m 600 $target/dev/rtc c 254 0


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

Added: trunk/examples/simple/scripts/CENTOS/30-mkinitrd
===================================================================
--- trunk/examples/simple/scripts/CENTOS/30-mkinitrd	                        (rev 0)
+++ trunk/examples/simple/scripts/CENTOS/30-mkinitrd	2011-02-11 10:37:54 UTC (rev 6288)
@@ -0,0 +1,24 @@
+#! /bin/bash
+
+# (c) Michael Goetze, 2010-2011, mgoetze at mgoetze.net
+
+error=0 ; trap "error=$((error|1))" ERR
+
+ainsl -v $target/etc/fstab "proc	/proc	proc	defaults	0 0"
+ainsl -v $target/etc/fstab "sysfs	/sys	sysfs	auto		0 0"
+
+version=`$ROOTCMD rpm -qv kernel | cut -d- -f2-`
+$ROOTCMD kudzu -q -k $version
+# Unfortunately mkinitrd is horrible at guessing which modules to include,
+# especially when the running kernel is different than the kernel for which
+# we are creating an initrd...
+drivers=""
+for bus in pci virtio; do
+	for dr in `$ROOTCMD kudzu -p -k $version -b $bus|grep driver:|cut -d' ' -f2|sort -u`; do
+		drivers+=" --preload=$dr"
+	done
+done
+
+$ROOTCMD mkinitrd -f -v $drivers /boot/initrd-$version.img $version
+
+exit $error


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

Added: trunk/examples/simple/scripts/CENTOS/40-install-grub
===================================================================
--- trunk/examples/simple/scripts/CENTOS/40-install-grub	                        (rev 0)
+++ trunk/examples/simple/scripts/CENTOS/40-install-grub	2011-02-11 10:37:54 UTC (rev 6288)
@@ -0,0 +1,51 @@
+#! /bin/bash
+
+# (c) Michael Goetze, 2011, mgoetze at mgoetze.net
+
+error=0 ; trap "error=$((error|1))" ERR
+
+if [ -r $LOGDIR/disk_var.sh ] ; then
+	. $LOGDIR/disk_var.sh
+else
+	echo "disk_var.sh not found!"
+	exit 1
+fi
+
+bootdev=`device2grub $BOOT_DEVICE`
+bootpart=`device2grub $BOOT_PARTITION`
+version=`$ROOTCMD rpm -qv kernel | cut -d- -f2-`
+if grep '[[:space:]]/boot[[:space:]]' $LOGDIR/fstab; then
+	bootdir=''
+else
+	bootdir='/boot'
+fi
+
+$ROOTCMD grub-install --just-copy
+
+$ROOTCMD grub --no-floppy --batch <<-EOF
+	root $bootpart
+	setup $bootdev
+	quit
+	EOF
+
+ln -s ./menu.lst $target/boot/grub/grub.conf
+
+if [ -f $target/boot/grub/spalsh.xpm.gz ]; then
+	pretty="splashimage=$bootpart$bootdir/grub/splash.xpm.gz"
+else
+	pretty="color cyan/blue white/blue"
+fi
+
+cat > $target/boot/grub/grub.conf <<-EOF
+	timeout 5
+	default 0
+	$pretty
+	hiddenmenu
+	
+	title CentOS ($version)
+	  root $bootpart
+	  kernel $bootdir/vmlinuz-$version root=$ROOT_PARTITION ro
+	  initrd $bootdir/initrd-$version.img
+	EOF
+
+exit $error


Property changes on: trunk/examples/simple/scripts/CENTOS/40-install-grub
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/examples/simple/scripts/CENTOS/90-cleanup
===================================================================
--- trunk/examples/simple/scripts/CENTOS/90-cleanup	                        (rev 0)
+++ trunk/examples/simple/scripts/CENTOS/90-cleanup	2011-02-11 10:37:54 UTC (rev 6288)
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+$ROOTCMD yum clean all


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

Modified: trunk/examples/simple/scripts/LAST/50-misc
===================================================================
--- trunk/examples/simple/scripts/LAST/50-misc	2011-02-11 10:29:34 UTC (rev 6287)
+++ trunk/examples/simple/scripts/LAST/50-misc	2011-02-11 10:37:54 UTC (rev 6288)
@@ -25,8 +25,10 @@
 fi
 
 # Make sure everything is configured properly
-echo "Running \"apt-get -f install\" for the last time."
-$ROOTCMD apt-get -f install
+if ifclass DEBIAN ; then
+	echo "Running \"apt-get -f install\" for the last time."
+	$ROOTCMD apt-get -f install
+fi
 
 lskernels=$(echo $target/boot/vmlinu*)
 [ -f ${lskernels%% *} ] || echo "ERROR: No kernel was installed. Have a look at shell.log"




More information about the Fai-commit mailing list