Added some patches against FAI for initial version of chroot update
authorMichael Prokop <devnull@localhost>
Fri, 21 Sep 2007 08:52:13 +0000 (10:52 +0200)
committerMichael Prokop <devnull@localhost>
Fri, 21 Sep 2007 08:52:13 +0000 (10:52 +0200)
docs/grml-live.txt
patches/README [new file with mode: 0644]
patches/fai_dirupdate_1.diff [new file with mode: 0644]
patches/fai_dirupdate_2.diff [new file with mode: 0644]
patches/fai_dirupdate_3.diff [new file with mode: 0644]
patches/fai_dirupdate_4.diff [new file with mode: 0644]

index 0ed0389..d4c81ae 100644 (file)
@@ -406,6 +406,9 @@ Known TODOs
 * support something like a directory /etc/grml/fai/packages to install
 additional Debian packages without the need for a Debian repository
 
 * support something like a directory /etc/grml/fai/packages to install
 additional Debian packages without the need for a Debian repository
 
+* provide hooks/options for updating an existing chroot/squashfs-file/ISO
+(work in progress, see patches directory inside source)
+
 * document the available classes in more detail (GRMLBASE, LATEX_CLEANUP,
 NO_ONLINE, REMOVE_DOCS, GRML_SMALL,...)
 
 * document the available classes in more detail (GRMLBASE, LATEX_CLEANUP,
 NO_ONLINE, REMOVE_DOCS, GRML_SMALL,...)
 
diff --git a/patches/README b/patches/README
new file mode 100644 (file)
index 0000000..8b28ba5
--- /dev/null
@@ -0,0 +1,7 @@
+fai_dirupdate_[1234].diff:
+
+Try to provide an "update chroot" action, like:
+
+  # TARGET=/dev/shm/grml_chroot fai -C/etc/grml/fai -cGRMLBASE,I386 dirupdate
+
+Needs work though...
diff --git a/patches/fai_dirupdate_1.diff b/patches/fai_dirupdate_1.diff
new file mode 100644 (file)
index 0000000..fb6ca3b
--- /dev/null
@@ -0,0 +1,42 @@
+--- /usr/lib/fai/subroutines.orig      2007-09-21 10:04:05.000000000 +0200
++++ /usr/lib/fai/subroutines   2007-09-21 10:34:40.000000000 +0200
+@@ -266,6 +266,9 @@
+       dirinstall)
+           task dirinstall
+           ;;
++      dirupdate)
++          task dirupdate
++          ;;
+       softupdate)
+           echo Performing FAI system update. All data may be overwritten!
+           task softupdate
+@@ -491,6 +494,29 @@
+     fi
+ }
+ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
++task_dirupdate() {
++
++    > $stamp
++
++    mkdir -p $FAI_ROOT
++    FAI_ROOT=$(cd $FAI_ROOT;pwd)
++    echo "Updating directory $FAI_ROOT"
++    task configure
++    task updatechroot
++    task finish
++
++    rm -f $stamp
++    unset LOGUSER # so logfile are not saved to remote
++    task savelog
++
++    if [ -f $stamp ]; then
++      echo "Error while executing commands in subshell."
++      echo "$stamp was not removed."
++      sendmon "TASKERROR install 21"
++      die "Please look at the log files in $LOGDIR for errors."
++    fi
++}
++# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ task_softupdate() {
+     local stamp=/var/run/fai/fai_softupdate_is_running
diff --git a/patches/fai_dirupdate_2.diff b/patches/fai_dirupdate_2.diff
new file mode 100644 (file)
index 0000000..14cab1a
--- /dev/null
@@ -0,0 +1,14 @@
+--- /usr/lib/fai/get-config-dir.orig   2007-09-21 10:13:24.000000000 +0200
++++ /usr/lib/fai/get-config-dir        2007-09-21 10:14:11.000000000 +0200
+@@ -9,6 +9,11 @@
+ # Short-Description: get $FAI directory from $FAI_CONFIG_SRC
+ ### END SUBROUTINE INFO
++if [ -n "FAI_NO_CONFIG_SRC" ] ; then
++      echo "Notice: skipping get-dir-config as requested"
++      exit 0
++fi
++
+ if [ -z "$FAI_CONFIG_SRC" ]; then
+       sendmon "TASKERROR get_fai_dir 21"
+       echo "Error: Provide the URL to obtain the fai config storage in \$FAI_CONFIG_SRC"
diff --git a/patches/fai_dirupdate_3.diff b/patches/fai_dirupdate_3.diff
new file mode 100644 (file)
index 0000000..b889724
--- /dev/null
@@ -0,0 +1,11 @@
+--- /usr/sbin/fai.orig 2007-09-21 10:45:21.000000000 +0200
++++ /usr/sbin/fai      2007-09-21 10:45:22.000000000 +0200
+@@ -280,7 +280,7 @@
+     trap 'clean_exit' EXIT
+ fi
+-mkfifo $LOGDIR/logfifo
++[ -w $LOGDIR/logfifo ] || mkfifo $LOGDIR/logfifo
+ tee -a $LOGDIR/fai.log < $LOGDIR/logfifo &
+ # in bash &> redirect stdout and stderr to file
+ fstart &> $LOGDIR/logfifo
diff --git a/patches/fai_dirupdate_4.diff b/patches/fai_dirupdate_4.diff
new file mode 100644 (file)
index 0000000..ad4d05f
--- /dev/null
@@ -0,0 +1,21 @@
+--- /usr/lib/fai/subroutines-linux.orig        2007-09-21 10:47:35.000000000 +0200
++++ /usr/lib/fai/subroutines-linux     2007-09-21 10:49:09.000000000 +0200
+@@ -229,6 +229,18 @@
+     updatebase
+ }
+ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
++task_updatechroot() {
++
++    # update the chroot
++    echo "Updating chroot"
++    if [ -z "$TARGET" ] ; then
++        echo "Error: \$TARGET not set, exiting.">&2
++        return 1
++    else
++        chroot $TARGET apt-get update
++    fi
++}
++# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ task_instsoft() {
+     echo "Installing software may take a while"