- # FAI softupdate does not execute upgrade, so let's do it on our own:
-# $ROOTCMD apt-get update
-# if [ -x $target/usr/bin/aptitude ] ; then
-# if strings $target/usr/bin/aptitude | grep safe-upgrade 1>/dev/null ; then
-# $ROOTCMD aptitude -y safe-upgrade
-# else
-# $ROOTCMD aptitude -y upgrade
-# fi
-# else
-# $ROOTCMD apt-get -y upgrade
-# fi
-
-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
-
-# Recommends just pull in way tooooo much packages, so disable it:
-echo "APT::Install-Recommends "false"; // added by grml-live" >> $target/etc/apt/apt.conf
-
-# install grml keys:
-gpg --keyserver subkeys.pgp.net --recv-keys F61E2E7CECDEA787 || \
-gpg --keyserver blackhole.pca.dfn.de --recv-keys F61E2E7CECDEA787
-gpg --export F61E2E7CECDEA787 > $target/etc/apt/grml.key
-$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
+ # run it on our own, as updatebase is used at the wrong stage for our needs,
+ # see /etc/grml/fai/config/hooks/updatebase.GRMLBASE
+ # the apt-get update might return an error if there's for example
+ # a hashsum mismatch on Debian mirror sources, we might want to continue
+ # but should warn the user
+ if ! $ROOTCMD apt-get update ; then
+ echo "Warning: there was an error executing apt-get update, continuing anyway."
+ fi
+
+ # newer aptitude versions won't remove essential packages using
+ # 'aptitude -f -y install file-rc' anymore, therefore force it:
+ $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
+
+ if ! [ -x $target/usr/bin/aptitude ] ; then
+ $ROOTCMD apt-get -y install aptitude
+ fi
+
+ if [ -x $target/usr/bin/aptitude ] ; then
+ if $ROOTCMD aptitude --help | grep -q safe-upgrade ; then
+ APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y safe-upgrade
+ else
+ APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y upgrade
+ fi
+ else
+ APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD apt-get -y upgrade
+ fi
+
+ exit # make sure we don't continue behind the following "fi"
+fi
+
+# no softupdate but fresh installation
+echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running"
+
+# make sure we have file-rc available before package_config/GRML* is being executed {{{
+# the apt-get update might return an error if there's for example
+# a hashsum mismatch on Debian mirror sources, we might want to continue
+# but should warn the user
+if ! $ROOTCMD apt-get update ; then
+ echo "Warning: there was an error executing apt-get update, continuing anyway."
+ echo "Warning: there was an error executing apt-get update, continuing anyway." >&2