[Fai-commit] r4161 - in people: . h01ger/live-CD h01ger/live-CD/live-include-dir oz oz/fai-conf-update

Oliver Osburg oz-guest at alioth.debian.org
Mon Nov 20 20:24:17 CET 2006


Author: oz-guest
Date: 2006-11-20 20:24:16 +0100 (Mon, 20 Nov 2006)
New Revision: 4161

Added:
   people/oz/
   people/oz/fai-conf-update/
   people/oz/fai-conf-update/README.txt
   people/oz/fai-conf-update/fai-conf-update.sh
Modified:
   people/h01ger/live-CD/README.txt
   people/h01ger/live-CD/live-include-dir/real-hook
   people/h01ger/live-CD/live-include-dir/sources.list
Log:
live-CD should produce a working install with the resulting image.
Very, very alpha.

initial import of fai-conf-update.sh



Modified: people/h01ger/live-CD/README.txt
===================================================================
--- people/h01ger/live-CD/README.txt	2006-11-19 12:09:27 UTC (rev 4160)
+++ people/h01ger/live-CD/README.txt	2006-11-20 19:24:16 UTC (rev 4161)
@@ -1,4 +1,4 @@
-(c) Holger Levsen 2006
+(c) Holger Levsen, Oliver Osburg 2006
 released under GPL2
 
 fai-live-cd with live-package
@@ -16,3 +16,6 @@
 - /etc/make-live.conf is not included, I basically used the package default
 - feedback is great
 - the live-cd works, but grub installation is buggy
+- install sequence runs now in softupdate-mode. 
+  This should probably be change to dirinstall or install
+- base.tgz has to be taken from some FAI nfsroot.

Modified: people/h01ger/live-CD/live-include-dir/real-hook
===================================================================
--- people/h01ger/live-CD/live-include-dir/real-hook	2006-11-19 12:09:27 UTC (rev 4160)
+++ people/h01ger/live-CD/live-include-dir/real-hook	2006-11-20 19:24:16 UTC (rev 4161)
@@ -7,7 +7,7 @@
 # populate fai config dir
 #
 mkdir -p /srv/fai/config
-cp -avx /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config/
+cp -ravx /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config/
 
 # fixme: this is just a wordaround for #390504
 mkdir -p /var/lib/fai
@@ -26,6 +26,11 @@
 update-rc.d run_fai start 99 2 3 4 5 . 
 
 #
+# copy base.tgz
+#
+cp base.tgz /var/tmp
+
+#
 # no autologin to casper user account
 #
 ### missing, not important atm
@@ -41,7 +46,7 @@
 PACKAGES install
 adduser apt apt-utils aptitude base-files base-passwd bash bsdmainutils bsdutils coreutils cpio cron debconf debconf-i18n debianutils diff dmidecode dpkg dselect e2fslibs e2fsprogs ed findutils gcc-4.1-base gettext-base gnupg grep groff-base gzip hostname ifupdown initscripts iptables iputils-ping klogd laptop-detect libacl1 libattr1 libblkid1 libbz2-1.0 libc6 libcap1 libcomerr2 libconsole libdb4.2 libdb4.3 libdb4.4 libdevmapper1.02 libgcc1 libgcrypt11 libgdbm3 libgnutls13 libgpg-error0 libldap-2.3-0 libldap2 liblocale-gettext-perl liblzo1 liblzo2-2 libncurses5 libncursesw5 libnewt0.52 libopencdk8 libpam-modules libpam-runtime libpam0g libpopt0 libreadline5 libsasl2 libselinux1 libsepol1 libsigc++-1.2-5c2 libsigc++-2.0-0c2a libslang2 libss2 libssl0.9.8 libstdc++6 libtasn1-2 libtasn1-3 libtasn1-3-bin libtext-charwidth-perl libtext-iconv-perl libtext-wrapi18n-perl libusb-0.1-4 libuuid1 libwrap0 login logrotate lsb-base makedev man-db manpages mawk mktemp module-init-tools modutils mount nano ncurses-base ncurses-bin net-tools netbase netcat openbsd-inetd passwd perl-base procps readline-common sed sysklogd sysv-rc sysvinit tar tasksel tasksel-data tcpd traceroute tzdata util-linux vim-common vim-tiny wget whiptail zlib1g
 module-init-tools dhcp3-client ssh rdate lshw hwinfo portmap bootpc rsync lftp rsh-client less dump reiserfsprogs usbutils psmisc pciutils hdparm smartmontools parted mdadm lvm2 dnsutils ntpdate dosfstools cvs jove xfsprogs xfsdump sysutils dialog discover mdetect libnet-perl console-tools console-common expect iproute udev subversion grub hwtools read-edid 
-debian-archive-keyring
+debian-archive-keyring grub live-package
 EOF
 
 # workaround stupid udev problem: s/disk1/hda/
@@ -70,21 +75,23 @@
 # first EOF in brackets to avoid escaping of variables
 cat > /srv/fai/config/hooks/softupdate.DEFAULT << 'EOF'
 #!/bin/bash
-
+swapoff /dev/hda5
 set_disk_info
-load_keymap_consolechars
+#load_keymap_consolechars
 
+/etc/init.d/udev stop
 task_partition
 task_mountdisks	
+task_extrbase
+
 # use debootstrap instead of task_extrbase	
-echo start debootstrap
-echo "target=$target"
-df -h
-debootstrap etch /tmp/target file:///media/mirror
+#echo start debootstrap
+#echo "target=$target"
+#df -h
+#debootstrap etch /tmp/target file:///media/mirror
 mkdir -p $target/media/mirror/debian
-echo mounting mirror into chroot
+#echo mounting mirror into chroot
 mount --bind /media/mirror $target/media/mirror/debian
-echo "deb file:///media/mirror/debian etch main" > $target/etc/apt/sources.list
 cat <<'FOE' > $target/etc/apt/apt.conf.d/10fai
 APT::Get::AllowUnauthenticated "true";
 Aptitude::CmdLine::Ignore-Trust-Violations yes;
@@ -99,24 +106,34 @@
 ff02::2 ip6-allrouters
 ff02::3 ip6-allhosts
 FOE
-
+rm -rf $target/etc/dpkg/log
+echo "deb file:///media/mirror/debian etch main" > $target/etc/apt/sources.list
 cat $target/etc/apt/sources.list
-echo debug: task_softupdate
-task_softupdate
-
+echo "debug: softinstall!!"
+chroot $target mount -t proc proc /proc
+chroot $target mount -t sysfs sysfs /sys
+chroot $target /etc/init.d/udev start
+mkdir -p $target/srv/fai/
+cp -rp /srv/fai/config $target/srv/fai/
+. /srv/fai/config/scripts/GRUB/10-setup
+task_installsoft
 EOF
 #
 # fix grub install - thanks to Oliver 'oz' Osburg
 #fixme: fstab fehlt
-cat > /srv/fai/config/scripts/GRUB/10-setup << 'EOF'
+cat /srv/fai/config/scripts/GRUB/10-setup << 'EOF'
 #! /bin/bash
 set -a
-[ -r /tmp/fai/disk_var.sh ] && . /tmp/fai/disk_var.sh
+[ -r /var/log/fai/current/disk_var.sh ] && . /var/log/fai/current/disk_var.sh
 error=0 ; trap "error=$((error|1))" ERR
 #fcopy -Uv boot/grub/menu.lst
 mkdir -p $target/boot/grub
 grub-install --no-floppy --root-directory=$target $BOOT_DEVICE
 GROOT=$(device2grub $BOOT_PARTITION)
+$ROOTCMD cp /proc/mounts /etc/mtab
+$ROOTCMD mount -a -o rw,remount
+$ROOTCMD /etc/init.d/udev start
+$ROOTCMD /usr/sbin/grub-install --no-floppy --recheck $BOOT_DEVICE
 $ROOTCMD /usr/sbin/update-grub -y
 echo "Grub installed on $BOOT_DEVICE on $GROOT"
 exit $error

Modified: people/h01ger/live-CD/live-include-dir/sources.list
===================================================================
--- people/h01ger/live-CD/live-include-dir/sources.list	2006-11-19 12:09:27 UTC (rev 4160)
+++ people/h01ger/live-CD/live-include-dir/sources.list	2006-11-20 19:24:16 UTC (rev 4161)
@@ -5,4 +5,4 @@
 #deb http://ftp.debian.org/debian etch-proposed-updates main contrib non-free
 
 #deb http://security.debian.org/debian-security etch/updates main contrib non-free
-deb file:///media/mirror/debian etch main contrib non-free
+deb file:///media/mirror/debian etch main

Added: people/oz/fai-conf-update/README.txt
===================================================================
--- people/oz/fai-conf-update/README.txt	2006-11-19 12:09:27 UTC (rev 4160)
+++ people/oz/fai-conf-update/README.txt	2006-11-20 19:24:16 UTC (rev 4161)
@@ -0,0 +1,27 @@
+fai-conf-update
+
+For what?
+
+This script is useful in a situation when you have to move the FAI 
+server to new hardware. Just call this script, and changes in /etc on 
+the install server will be transferred to the FAI config-space.
+
+when you run fai-cd (currently broken) or h01gers fai-live, this updated 
+config space is used for the installation with the CD. Thus, one can 
+save much time in moving servers to new hardware, as all services are 
+re-installed automatically.
+
+In most cases, the installation should work as on the old box. In the 
+case of needed tweaks the hardware - just run this script again 
+on the *new* server, and burn the image on CD until all errors are 
+fixed, mostly one run should be sufficient.
+
+I'd call it: "Server Evolution". :-)
+
+
+Bugs, limitations:
+
+- This script is very alpha. 
+- It would also be nice to update the 
+  packages list in the config-space. 
+- Nice: pre-check of the config-space with failint!

Added: people/oz/fai-conf-update/fai-conf-update.sh
===================================================================
--- people/oz/fai-conf-update/fai-conf-update.sh	2006-11-19 12:09:27 UTC (rev 4160)
+++ people/oz/fai-conf-update/fai-conf-update.sh	2006-11-20 19:24:16 UTC (rev 4161)
@@ -0,0 +1,46 @@
+#! /bin/sh
+# fai-conf-update
+# script to update the FAI configspace based on FAI Classes.
+#
+# ToDo:
+# - update of the package config
+# - flags to change output: output in patch form.
+# - tesing of installscripts with the new config on the running installserver
+# 
+# FixMe:
+# -ugly grep after the find. 
+#
+
+FAI_CONFIGSPACE=/srv/fai/config
+CLASSES=`cat /var/log/fai/localhost/last/FAI_CLASSES`
+SHELLSCRIPT="/root/update_fai.sh"
+
+if [ -f $SHELLSCRIPT ]; then
+    echo "$SHELLSCRIPT exists, aborting."
+    exit 1
+fi
+
+# Loop through the classes
+
+for i in $CLASSES; do
+
+#    Find the config files, strip off the class name in the end
+#    loop through the files
+
+    for j in `find $FAI_CONFIGSPACE/files -type f -name ".svn" -prune -o -name $i -print | grep -v \.svn`; do
+	name=`echo $j | sed "s#$FAI_CONFIGSPACE/files##"| sed s/\\\/$i//`
+
+	if [ -f $name ]; then
+	    if  ! diff -q $name $j  >& /dev/null ; then
+		echo "class $i needs update from $name to $j"
+		echo "cp $name $j" >> $SHELLSCRIPT
+	    fi
+	    if [ ! -f $name ]; then
+		echo file "$name is not existing on this machine, removing it from the config space"
+		echo "rm $j" >> $SHELLSCRIPT
+	    fi
+	fi
+    done
+done
+
+echo "review the results in $SHELLSCRIPT and run it to actually update the FAI config space."


Property changes on: people/oz/fai-conf-update/fai-conf-update.sh
___________________________________________________________________
Name: svn:executable
   + *




More information about the Fai-commit mailing list