[Fai-commit] r3473 - in people/mugwump/vserver: . bin debian doc lib

fai-commit at lists.alioth.debian.org fai-commit at lists.alioth.debian.org
Thu Jun 8 15:07:17 UTC 2006


Author: samv-guest
Date: 2006-05-02 20:53:20 +0000 (Tue, 02 May 2006)
New Revision: 3473

Modified:
   people/mugwump/vserver/
   people/mugwump/vserver/bin/fai
   people/mugwump/vserver/debian/
   people/mugwump/vserver/debian/changelog
   people/mugwump/vserver/doc/
   people/mugwump/vserver/lib/create_ramdisk
   people/mugwump/vserver/lib/mkrw
   people/mugwump/vserver/lib/subroutines
   people/mugwump/vserver/lib/subroutines-linux
Log:
Various modifications for building vservers



Property changes on: people/mugwump/vserver
___________________________________________________________________
Name: svn:ignore
   + build-stamp
Name: svk:merge
   + d29f7b36-84ff-0310-85ce-ba787dbd31ca:/local/fai/people/mugwump/vserver:8122

Modified: people/mugwump/vserver/bin/fai
===================================================================
--- people/mugwump/vserver/bin/fai	2006-05-02 20:51:02 UTC (rev 3472)
+++ people/mugwump/vserver/bin/fai	2006-05-02 20:53:20 UTC (rev 3473)
@@ -35,6 +35,7 @@
 stamp=$rundir/FAI_INSTALLATION_IN_PROGRESS
 romountopt="-o async,noatime,nolock,ro,actimeo=1800"
 fstab=fstab  # Solaris uses vfstab
+debug=1
 
 # the type of operating system (linux, sunos)
 oclass=$(uname -s | tr a-z A-Z)
@@ -112,14 +113,16 @@
 
     if [ X$oclass = XLINUX ]; then
 	if [ $DO_INIT_TASKS -eq 1 ]; then
-	    grep -q '[[:space:]]sysfs' /proc/filesystems && mount -t sysfs sysfs /sys
-	    ifup lo
-	    [ -x /etc/init.d/udev ] && /etc/init.d/udev start
-	    [ -x /sbin/portmap ] && /sbin/portmap
-	    mount -t devpts devpts /dev/pts
-	    # add other options for nfs mount of /dev/root to root-path in dhcpd.conf
-	    mount -o remount,noatime,ro /dev/root /
-	    cat /proc/kmsg >/dev/tty4 &
+	    if [ -z "$VIRTUAL" ]; then
+	        grep -q '[[:space:]]sysfs' /proc/filesystems && mount -t sysfs sysfs /sys
+	        ifup lo
+	        [ -x /etc/init.d/udev ] && /etc/init.d/udev start
+	        [ -x /sbin/portmap ] && /sbin/portmap
+	        mount -t devpts devpts /dev/pts
+	        # add other options for nfs mount of /dev/root to root-path in dhcpd.conf
+	        mount -o remount,noatime,ro /dev/root /
+	        cat /proc/kmsg >/dev/tty4 &
+            fi
 	fi
     fi
 
@@ -201,6 +204,8 @@
     # HG: are we called as an init substitute ?
     export DO_INIT_TASKS=0
     [ "$0" = "/etc/init.d/rcS" ] && DO_INIT_TASKS=1
+    echo GOT HERE
+    [ -d /proc/self -a ! -e /proc/cmdline ] && export VIRTUAL=1
     [ $DO_INIT_TASKS -eq 1 ] && renewclass=1 # always renew class list when installing
 
     # Solaris has already a writable /tmp directory


Property changes on: people/mugwump/vserver/debian
___________________________________________________________________
Name: svn:ignore
   + fai-client
fai-doc
fai-doc.*.debhelper
fai-nfsroot
fai-quickstart
fai-server
files
tmp


Modified: people/mugwump/vserver/debian/changelog
===================================================================
--- people/mugwump/vserver/debian/changelog	2006-05-02 20:51:02 UTC (rev 3472)
+++ people/mugwump/vserver/debian/changelog	2006-05-02 20:53:20 UTC (rev 3473)
@@ -1,3 +1,9 @@
+fai (2.10.1-1) unstable; urgency=low
+
+  * get_fai_dir: check not already mounted
+
+ -- Sam Vilain <sam at vilain.net>  Thu, 27 Apr 2006 16:32:59 +1200
+
 fai (2.10.1) unstable; urgency=low
 
   * fai-chboot: fix division by zero error


Property changes on: people/mugwump/vserver/doc
___________________________________________________________________
Name: svn:ignore
   + fai-guide.*

Modified: people/mugwump/vserver/lib/create_ramdisk
===================================================================
--- people/mugwump/vserver/lib/create_ramdisk	2006-05-02 20:51:02 UTC (rev 3472)
+++ people/mugwump/vserver/lib/create_ramdisk	2006-05-02 20:53:20 UTC (rev 3473)
@@ -4,18 +4,31 @@
 
 # create a writeable area on the install client
 
-mount -n -t proc proc /proc
+if [ ! -e /proc/self ]
+then
+    mount -n -t proc proc /proc
+fi
+
 # start devfsd if needed
 if [ -c /dev/.devfsd ]; then
     /sbin/devfsd /dev
 fi
 
-# if we have shm use it as ramdisk
-mount -t tmpfs tmpfs /tmp || {
-    ramdevice=/dev/ram0
-    mke2fs -q -m 0 $ramdevice && echo "ramdisk $ramdevice created"
-    mount -n $ramdevice /tmp
-}
-mkdir -p /tmp/etc /tmp/target
+# perhaps we already have a ramdisk set up
+temp=`mktemp -q -p /tmp`
+if [ $? -eq 0 ]
+then
+   echo "create_ramdisk: /tmp is already writable, magic!"
+   rm $temp
+   mkdir /tmp/etc
+else
+    # if we have shm use it as ramdisk
+    mount -t tmpfs tmpfs /tmp || {
+        ramdevice=/dev/ram0
+        mke2fs -q -m 0 $ramdevice && echo "ramdisk $ramdevice created"
+        mount -n $ramdevice /tmp
+    }
+    mkdir -p /tmp/etc /tmp/target
+fi
 
 mkrw /dev /var/run /var/log /var/lock /var/lib/discover /etc/sysconfig

Modified: people/mugwump/vserver/lib/mkrw
===================================================================
--- people/mugwump/vserver/lib/mkrw	2006-05-02 20:51:02 UTC (rev 3472)
+++ people/mugwump/vserver/lib/mkrw	2006-05-02 20:53:20 UTC (rev 3473)
@@ -20,9 +20,22 @@
 	return
     fi
 
+    # test for already writable
+    temp=`mktemp -q -p $2`
+    if [ $? -eq 0 ]
+    then
+	echo "mkrw: $2 is already writable."
+	rm $temp && return
+    fi
+
     local tmp1=$(mktemp) || exit 12
     tar -C $2 -cf $tmp1 .
-    mount -o size=$1 -t tmpfs tmpfs $2
+    mount -o size=$1 -t tmpfs tmpfs $2 2>/dev/null || (
+	dirname="`echo $2 | sed 's/\//_/g'`"
+	mkdir /tmp/$dirname
+	echo "Making $2 writable with a bind mount from /tmp/$dirname"
+	mount --bind /tmp/$dirname $2
+    )
     tar -C $2 -xf $tmp1
     rm -f $tmp1
 }

Modified: people/mugwump/vserver/lib/subroutines
===================================================================
--- people/mugwump/vserver/lib/subroutines	2006-05-02 20:51:02 UTC (rev 3472)
+++ people/mugwump/vserver/lib/subroutines	2006-05-02 20:53:20 UTC (rev 3473)
@@ -157,8 +157,13 @@
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 get_fai_dir() {
 
+    # maybe /fai has already been put magically where we want it
+    if [ -d "$FAI/class" ]
+    then
+        return
+    fi
+
     # get /fai directory; mount it or get it from a cvs repository
-
     [ -f /boot/RUNNING_FROM_FAICD ] && mkrw $FAI
     if [ -z "$FAI_LOCATION" ]; then
        get_fai_cvs
@@ -384,6 +389,7 @@
 task_faiend() {
 
     [ $DO_INIT_TASKS -eq 0 ] && exit 0
+    [ -n "$VIRTUAL" ] && exit 0
     wait_for_jobs
     echo "Press <RETURN> to reboot or ctrl-c to execute a shell"
     # reboot without prompting if FAI_FLAG reboot is set

Modified: people/mugwump/vserver/lib/subroutines-linux
===================================================================
--- people/mugwump/vserver/lib/subroutines-linux	2006-05-02 20:51:02 UTC (rev 3472)
+++ people/mugwump/vserver/lib/subroutines-linux	2006-05-02 20:53:20 UTC (rev 3473)
@@ -10,6 +10,8 @@
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 set_disk_info() {
 
+    [ -n "$VIRTUAL" ] && return
+
     # the variable holds a space separated list of devices and their block size
     device_size=$(disk-info)
 
@@ -20,7 +22,7 @@
 jobsrunning() {
 
     # test if jobs are running
-    ps r | egrep -qv "ps r|TIME COMMAND"
+    ps r | egrep -v "ps r|TIME COMMAND|$0"
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 eval_cmdline() {
@@ -28,14 +30,20 @@
     # parse kernel parameters and define variables
     local word
 
-    echo -n "Kernel parameters: "; cat /proc/cmdline
-    for word in $(cat /proc/cmdline) ; do
-	case $word in
-	    [a-zA-Z]*=*)
-		eval $word
-		;;
-	esac
-    done
+    if [ -e /proc/cmdline ]
+    then
+        echo -n "Kernel parameters: "; cat /proc/cmdline
+        for word in $(cat /proc/cmdline) ; do
+	    case $word in
+	        [a-zA-Z]*=*)
+		    eval $word
+		    ;;
+	    esac
+        done
+    else
+        echo "No /proc/cmdline - must be virtual, assuming env. already set up"
+	export VIRTUAL=1
+    fi
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 task_confdir() {
@@ -44,14 +52,17 @@
         local bootlog
         eval_cmdline
 
-        bootlog=$LOGDIR/boot.log
-        get-boot-info
-        echo "Reading $bootlog"
-        . $bootlog
-        unset T170 T171 T172 ROOT_PATH BOOTFILE
+	if [ -z "$VIRTUAL" ]
+	then
+            bootlog=$LOGDIR/boot.log
+            get-boot-info
+            echo "Reading $bootlog"
+            . $bootlog
+            unset T170 T171 T172 ROOT_PATH BOOTFILE
+            echo 6 > /proc/sys/kernel/printk
+	    klogd -c7 -f $LOGDIR/kernel.log
+	fi
 
-        echo 6 > /proc/sys/kernel/printk
-	klogd -c7 -f $LOGDIR/kernel.log
 	syslogd -m 0
         create_resolv_conf
     fi




More information about the Fai-commit mailing list