instsoft.GRMLBASE: do not run explicit apt-get update any longer
[grml-live.git] / etc / grml / fai / config / hooks / instsoft.GRMLBASE
index fcc2bdb..4b36e51 100755 (executable)
@@ -60,15 +60,6 @@ if [ "$FAI_ACTION" = "softupdate" ] ; then
 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
 EOF
 
-   # run it on our own, as updatebase is used at the wrong stage for our needs,
-   # see ${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
-
    # work around /etc/kernel/postinst.d/zz-update-grub failing
    # inside openvz environment, see #597084
    if ! $ROOTCMD dpkg-divert --list | grep -q '/usr/sbin/update-grub' ; then
@@ -81,18 +72,25 @@ EOF
   # '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
+   if ! $ROOTCMD test -x /usr/bin/aptitude ; then
       $ROOTCMD apt-get -y install aptitude
    fi
 
-   if [ -x $target/usr/bin/aptitude ] ; then
+   # make sure we can upgrade automatically,
+   # even with unsigned repos, but only if user wants it
+   if [ "${FAI_ALLOW_UNSIGNED:-}" = "1" ] ; then
+     APTGET_OPTS="${APTGET_OPTS:-} --allow-unauthenticated"
+     APTITUDE_OPTS="${APTITUDE_OPTS:-} --allow-untrusted"
+   fi
+
+   if $ROOTCMD test -x /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
+         APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y $APTITUDE_OPTS safe-upgrade
       else
-         APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y upgrade
+         APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y $APTITUDE_OPTS upgrade
       fi
    else
-      APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD apt-get -y upgrade
+      APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD apt-get -y $APTGET_OPTS --force-yes upgrade
    fi
 
    exit # make sure we don't continue behind the following "fi"