New option -b for build-only
[grml-live.git] / patches / fai_chroot_update.patch
diff --git a/patches/fai_chroot_update.patch b/patches/fai_chroot_update.patch
new file mode 100644 (file)
index 0000000..350f613
--- /dev/null
@@ -0,0 +1,63 @@
+--- subroutines.orig   2007-12-16 11:20:12.000000000 +0000
++++ subroutines        2007-12-16 11:23:01.000000000 +0000
+@@ -294,6 +294,10 @@
+           echo Performing FAI system update. All data may be overwritten!
+           task softupdate
+           ;;
++      chrootupdate)
++          echo Performing FAI chroot update. All data may be overwritten!
++          task chrootupdate
++          ;;
+       sysinfo)
+           echo Showing system information.
+           task sysinfo
+@@ -568,6 +572,49 @@
+ }
+ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
++task_chrootupdate() {
++
++    local stamp=/var/run/fai/fai_chrootupdate_is_running
++
++    [ -f "$stamp" ] && die "Another fai chrootupdate is already running. Aborting."
++    echo $$ > $stamp
++    # if the system had been installed using fai < 3.0 disk_var.sh is found in /etc/fai
++    if [ ! -f /var/lib/fai/disk_var.sh -a -f /etc/fai/disk_var.sh ] ; then
++      mv /etc/fai/disk_var.sh /var/lib/fai/
++    fi
++    # the following copy operation is required to make $LOGDIR a reliable source
++    # for disk_var.sh
++    # use the last disk_var during update if available
++    [ -f /var/lib/fai/disk_var.sh ] && cp -p /var/lib/fai/disk_var.sh $LOGDIR 
++
++    defnop wait_for_jobs
++    save_dmesg
++
++    task mirror
++    task debconf
++    task configure
++    date
++    echo "The $FAI_ACTION took $[$(cut -d . -f 1 /proc/uptime)-$start_seconds] seconds."
++
++    rm -f $stamp
++    # save again, because new messages could be created
++    save_dmesg
++    task savelog
++
++    if [ -f $stamp ]; then
++      echo "Error while executing commands in subshell."
++      echo -n "$stamp was not removed. PID of running process: "
++      cat $stamp
++      sendmon "TASKERROR chrootupdate 21"
++      die "Please look at the log files in $LOGDIR for errors."
++    fi
++    echo $FAI_CONFIG_SRC | grep -q ^nfs://
++    if [ $? -eq 0 ]; then
++      grep -q ^$FAI /etc/mtab && umount $FAI
++    fi
++}
++# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
++
+ catnc() {
+     # cat but no comment lines
+     egrep -v "^#" $@