From 3ff2a862f83553916a1148543d69a0bbcc97bf4d Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 29 Oct 2007 00:47:11 +0100 Subject: [PATCH] Support option -u for updating; added FAI patches; several other small updates --- debian/changelog | 5 ++++ debian/rules | 1 + etc/grml/fai/config/hooks/instsoft.GRMLBASE | 22 ++++++++++++++- etc/grml/fai/fai.conf | 4 ++- grml-live | 24 ++++++++++++++--- patches/README | 11 -------- patches/fai_dirinstall_check.diff | 12 --------- patches/fai_dirupdate_1.diff | 42 ----------------------------- patches/fai_dirupdate_2.diff | 14 ---------- patches/fai_dirupdate_3.diff | 11 -------- patches/fai_dirupdate_4.diff | 21 --------------- patches/fai_fix_debopts_vs_debopt.patch | 11 ++++++++ patches/fai_mention_debopts.patch | 11 ++++++++ patches/fai_support_aptitude_in_updatebase | 14 ++++++++++ 14 files changed, 86 insertions(+), 117 deletions(-) delete mode 100644 patches/README delete mode 100644 patches/fai_dirinstall_check.diff delete mode 100644 patches/fai_dirupdate_1.diff delete mode 100644 patches/fai_dirupdate_2.diff delete mode 100644 patches/fai_dirupdate_3.diff delete mode 100644 patches/fai_dirupdate_4.diff create mode 100644 patches/fai_fix_debopts_vs_debopt.patch create mode 100644 patches/fai_mention_debopts.patch create mode 100644 patches/fai_support_aptitude_in_updatebase diff --git a/debian/changelog b/debian/changelog index 3fbac63..fc8d777 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,10 @@ grml-live (0.0.7) unstable; urgency=low + * Added FAI patches to /usr/share/grml-live/patches/ - it's + recommended to apply the patches to FAI until they are accepted + upstream. See Debian's BTS for more details: #444210, #447080 + and #448426. + * Support option '-u' for updating system. * Reworked buildd concept. - Now we have a seperate /usr/share/grml-live/buildd/functions.sh for generic stuff diff --git a/debian/rules b/debian/rules index 971a44a..b6f13d9 100755 --- a/debian/rules +++ b/debian/rules @@ -38,6 +38,7 @@ install: build cp -a examples debian/grml-live/usr/share/doc/grml-live/ cp -a templates debian/grml-live/usr/share/grml-live/ cp -a scripts debian/grml-live/usr/share/grml-live/ + cp -a patches debian/grml-live/usr/share/grml-live/ cp -a buildd/*.sh debian/grml-live/usr/share/grml-live/buildd/ install -o root -m 640 buildd/grml-buildd.conf debian/grml-live/etc/grml/grml-buildd.conf install -o root -m 755 grml-live debian/grml-live/usr/sbin/grml-live diff --git a/etc/grml/fai/config/hooks/instsoft.GRMLBASE b/etc/grml/fai/config/hooks/instsoft.GRMLBASE index 5e543f2..441b009 100755 --- a/etc/grml/fai/config/hooks/instsoft.GRMLBASE +++ b/etc/grml/fai/config/hooks/instsoft.GRMLBASE @@ -10,6 +10,24 @@ set -u set -e +if [ "$FAI_ACTION" = "softupdate" ] ; then + echo "Softupdate" + # make sure we prefer grml repository: + if [ -r /etc/grml/fai/apt/preferences ] ; then + cp /etc/grml/fai/apt/preferences $target/etc/apt/preferences + fi + + if [ -r /etc/grml/fai/apt/sources.list ] ; then + if [ -L $target/etc/apt/sources.list ] ; then + rm $target/etc/apt/sources.list + fi + cp /etc/grml/fai/apt/sources.list $target/etc/apt/sources.list + fi + + $ROOTCMD apt-get update + +else # no softupdate but fresh installation + # work around http://trac.lighttpd.net/trac/ticket/657 # should be removed later on: echo "Acquire::http::Pipeline-Depth "0"; // added by grml-live" >> $target/etc/apt/apt.conf @@ -22,7 +40,7 @@ $ROOTCMD apt-key add /etc/apt/grml.key # make sure we prefer grml repository: if [ -r /etc/grml/fai/files/etc/apt/preferences ] ; then - cp /etc/grml/fai/apt//preferences $target/etc/apt/preferences + cp /etc/grml/fai/apt/preferences $target/etc/apt/preferences fi # make sure we have file-rc available before @@ -56,5 +74,7 @@ if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then $ROOTCMD dpkg-divert --package fai --rename --remove /usr/sbin/invoke-rc.d fi +fi # end of FAI_ACTION = softupdate + ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3 diff --git a/etc/grml/fai/fai.conf b/etc/grml/fai/fai.conf index 648c402..f37a52e 100644 --- a/etc/grml/fai/fai.conf +++ b/etc/grml/fai/fai.conf @@ -26,6 +26,7 @@ FAI_CONFIGDIR=/etc/grml/fai/config # default if undefined here: nfs://`hostname`/$FAI_CONFIGDIR # supported URL-types: nfs, file, cvs, cvs+ssh, svn+file, svn+http,... #FAI_CONFIG_SRC=nfs://yourservername$FAI_CONFIGDIR +FAI_CONFIG_SRC=file:///etc/grml/fai # the following variables are read only for most users @@ -33,4 +34,5 @@ FAI_CONFIGDIR=/etc/grml/fai/config MNTPOINT=/media/mirror # the local configuration directory on the install client -FAI=/var/lib/fai/config +#FAI=/var/lib/fai/config +FAI=/etc/grml/fai/config diff --git a/grml-live b/grml-live index cb715e0..d5cd4a3 100755 --- a/grml-live +++ b/grml-live @@ -4,7 +4,7 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2 or any later version. -# Latest change: Sun Oct 28 15:26:10 CET 2007 [mika] +# Latest change: Sun Oct 28 23:52:20 CET 2007 [mika] ################################################################################ # read configuration files, set some misc variables {{{ @@ -31,9 +31,16 @@ if [ -r /var/run/fai/FAI_INSTALLATION_IN_PROGRESS ] ; then exit 1 fi +if [ -r /var/run/fai/fai_softupdate_is_running ] ; then + echo "/usr/sbin/fai softupdate already running or was aborted before.">&2 + echo "You may remove /var/run/fai/fai_softupdate_is_running and try again.">&2 + exit 1 +fi + # make sure they are not set by default VERBOSE='' FORCE='' +UPDATE='' if [ -r /etc/grml/lsb-functions ] ; then . /etc/grml/lsb-functions @@ -170,7 +177,7 @@ http://grml.org/bugs/ # command line parsing {{{ -while getopts "a:c:g:i:o:r:s:t:v:FhV" opt; do +while getopts "a:c:g:i:o:r:s:t:v:FhuV" opt; do case "$opt" in a) ARCH="$OPTARG" ;; c) CLASSES="$OPTARG" ;; @@ -187,6 +194,7 @@ while getopts "a:c:g:i:o:r:s:t:v:FhV" opt; do v) VERSION="$OPTARG" ;; F) FORCE=1 ;; h) usage ; bailout 0 ;; + u) UPDATE=1 ;; V) VERBOSE="-v" ;; ?) echo "invalid option -$OPTARG" >&2; bailout 1 ;; esac @@ -221,6 +229,7 @@ if [ -z "$FORCE" ] ; then [ -n "$FAI_ARGS" ] && echo " additional arguments for FAI: $FAI_ARGS" [ -n "$LOGFILE" ] && echo " Logging to file: $LOGFILE" [ -n "$VERBOSE" ] && echo " Using VERBOSE mode." + [ -n "$UPDATE" ] && echo " Executing UPDATE instead of fresh installation." echo echo -n "Is this ok for you? [y/N] " read a @@ -290,7 +299,13 @@ fi # CHROOT_OUTPUT - execute FAI {{{ [ -n "$CHROOT_OUTPUT" ] || CHROOT_OUTPUT="$OUTPUT/grml_chroot" -if [ -d "$CHROOT_OUTPUT/bin" ] ; then +if [ -n "$UPDATE" ] ; then + FAI_ACTION=softupdate +else + FAI_ACTION=dirinstall +fi + +if [ -d "$CHROOT_OUTPUT/bin" -a -z "$UPDATE" ] ; then log "$CHROOT_OUTPUT exists already, skipping stage 'fai dirinstall'" ewarn "$CHROOT_OUTPUT exists already, skipping stage 'fai dirinstall'" ; eend 0 else @@ -299,7 +314,7 @@ else mkdir -p "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}" mount --bind "${MIRROR_DIRECTORY}" "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}" fi - fai $VERBOSE -C "$GRML_FAI_CONFIG" -c"$CLASSES" -u "$HOSTNAME" dirinstall "$CHROOT_OUTPUT" $FAI_ARGS | tee -a $LOGFILE + fai $VERBOSE -C "$GRML_FAI_CONFIG" -c"$CLASSES" -u "$HOSTNAME" $FAI_ACTION "$CHROOT_OUTPUT" $FAI_ARGS | tee -a $LOGFILE log "Setting /etc/grml_version to $GRML_NAME $VERSION Release Codename $RELEASENAME [$ISO_DATE]" echo "$GRML_NAME $VERSION Release Codename $RELEASENAME [$ISO_DATE]" > $CHROOT_OUTPUT/etc/grml_version chmod 644 $CHROOT_OUTPUT/etc/grml_version @@ -312,6 +327,7 @@ else if [ -r "/var/log/fai/dirinstall/$HOSTNAME/software.log" ] ; then # 1 errors during executing of commands # Unable to write mmap - msync (28 No space left on device) + # 'No candidate version found for' [/var/log/fai/current/software.log] grep 'dpkg: error processing' /var/log/fai/dirinstall/$HOSTNAME/software.log >> $LOGFILE && ERROR=1 grep 'E: Method http has died unexpectedly!' /var/log/fai/dirinstall/$HOSTNAME/software.log >> $LOGFILE && ERROR=2 grep 'ERROR: chroot' /var/log/fai/dirinstall/$HOSTNAME/software.log >> $LOGFILE && ERROR=3 diff --git a/patches/README b/patches/README deleted file mode 100644 index 00fc21a..0000000 --- a/patches/README +++ /dev/null @@ -1,11 +0,0 @@ -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... - -fai_dirinstall_check.diff: - -Make sure to exit in fai dirinstall if task instsoft wasn't successfull. diff --git a/patches/fai_dirinstall_check.diff b/patches/fai_dirinstall_check.diff deleted file mode 100644 index 69aef39..0000000 --- a/patches/fai_dirinstall_check.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- /usr/lib/fai/subroutines.orig 2007-09-21 10:46:23.000000000 +0200 -+++ /usr/lib/fai/subroutines 2007-09-21 19:36:34.000000000 +0200 -@@ -476,6 +476,9 @@ - task prepareapt - task updatebase - task instsoft -+ if grep -q 'E: Sub-process /usr/bin/dpkg returned an error code' $LOGDIR/software.log ; then -+ die "Error in software installation task." -+ fi - task configure - task finish - diff --git a/patches/fai_dirupdate_1.diff b/patches/fai_dirupdate_1.diff deleted file mode 100644 index fb6ca3b..0000000 --- a/patches/fai_dirupdate_1.diff +++ /dev/null @@ -1,42 +0,0 @@ ---- /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 deleted file mode 100644 index 14cab1a..0000000 --- a/patches/fai_dirupdate_2.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- /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 deleted file mode 100644 index b889724..0000000 --- a/patches/fai_dirupdate_3.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- /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 deleted file mode 100644 index ad4d05f..0000000 --- a/patches/fai_dirupdate_4.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- /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" diff --git a/patches/fai_fix_debopts_vs_debopt.patch b/patches/fai_fix_debopts_vs_debopt.patch new file mode 100644 index 0000000..aab6cc0 --- /dev/null +++ b/patches/fai_fix_debopts_vs_debopt.patch @@ -0,0 +1,11 @@ +--- /usr/sbin/fai 2007-10-17 21:20:47.000000000 +0000 ++++ /usr/sbin/fai 2007-10-17 21:20:50.000000000 +0000 +@@ -223,7 +223,7 @@ + + export NFSROOT=$(source $FAI_ETC_DIR/make-fai-nfsroot.conf; echo $NFSROOT) + export FAI_DEBOOTSTRAP=$(source $FAI_ETC_DIR/make-fai-nfsroot.conf; echo $FAI_DEBOOTSTRAP) +- export FAI_DEBOOTSTRAP_OPT=$(source $FAI_ETC_DIR/make-fai-nfsroot.conf; echo $FAI_DEBOOTSTRAP_OPT) ++ export FAI_DEBOOTSTRAP_OPTS=$(source $FAI_ETC_DIR/make-fai-nfsroot.conf; echo $FAI_DEBOOTSTRAP_OPTS) + + fi + diff --git a/patches/fai_mention_debopts.patch b/patches/fai_mention_debopts.patch new file mode 100644 index 0000000..1b99543 --- /dev/null +++ b/patches/fai_mention_debopts.patch @@ -0,0 +1,11 @@ +--- /usr/lib/fai/subroutines-linux 2007-10-17 21:21:11.000000000 +0000 ++++ /usr/lib/fai/subroutines-linux 2007-10-17 21:21:03.000000000 +0000 +@@ -124,7 +124,7 @@ + + local dversion=$(dpkg -l debootstrap | grep debootstrap | cut -f7 -d' ') + echo "Creating base system using debootstrap version $dversion" +- echo "Calling debootstrap $1 $FAI_ROOT $2" ++ echo "Calling debootstrap $1 $FAI_DEBOOTSTRAP_OPTS $FAI_ROOT $2" + yes '' | LC_ALL=C debootstrap $FAI_DEBOOTSTRAP_OPTS $1 $FAI_ROOT $2 + } + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/patches/fai_support_aptitude_in_updatebase b/patches/fai_support_aptitude_in_updatebase new file mode 100644 index 0000000..173c4cf --- /dev/null +++ b/patches/fai_support_aptitude_in_updatebase @@ -0,0 +1,14 @@ +--- /usr/lib/fai/updatebase.orig 2007-10-29 00:12:49.000000000 +0100 ++++ /usr/lib/fai/updatebase 2007-10-29 00:13:27.000000000 +0100 +@@ -31,7 +31,11 @@ + [ $? -ne 0 ] && yes '' | $ROOTCMD dpkg --configure -a + # using the above value, causes an error: "dpkg need action" + export aptopt= ++if [ -x /usr/bin/aptitude ] ; then ++$ROOTCMD aptitude $aptopt -f -y dist-upgrade $FAI_ROOT/$tmp -- 2.1.4