Rework apt.conf handling in instsoft/updatebase (provide /etc/apt/apt.conf.d/15grml...
authorMichael Prokop <mika@grml.org>
Tue, 14 Dec 2010 15:34:48 +0000 (16:34 +0100)
committerMichael Prokop <mika@grml.org>
Wed, 15 Dec 2010 15:09:18 +0000 (16:09 +0100)
etc/grml/fai/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE [new file with mode: 0644]
etc/grml/fai/config/hooks/instsoft.GRMLBASE
etc/grml/fai/config/hooks/updatebase.GRMLBASE
etc/grml/fai/config/scripts/GRMLBASE/99-finish-grml-build

diff --git a/etc/grml/fai/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE b/etc/grml/fai/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE
new file mode 100644 (file)
index 0000000..4b92b37
--- /dev/null
@@ -0,0 +1,7 @@
+// Installed via /etc/grml/fai/config/files/etc/apt/apt.conf.d/15grml-live/GRMLBASE
+
+// work around http://trac.lighttpd.net/trac/ticket/657
+Acquire::http::Pipeline-Depth 0; // added by grml-live"
+
+// Recommends just pull in way tooooo much packages, so disable it:
+APT::Install-Recommends false;   // added by grml-live
index b47152b..5dc3433 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 #!/bin/bash
-# Filename:      /etc/grml/fai/config/hooks/instsoft.GRML
-# Purpose:       grml specific Debian installation in the chroot
+# Filename:      /etc/grml/fai/config/hooks/instsoft.GRMLBASE
+# Purpose:       Grml specific software installation in the chroot, executed after updatebase
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2 or any later version.
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2 or any later version.
@@ -9,17 +9,8 @@
 set -u
 set -e
 
 set -u
 set -e
 
-# visualize chroot inside zsh:
-echo grml_chroot > $target/etc/debian_chroot
-
-HOSTNAME=''
-[ -r /etc/grml/grml-live.conf ]  && . /etc/grml/grml-live.conf
-[ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
-[ -n "$HOSTNAME" ] || HOSTNAME=grml
-echo "$HOSTNAME" > $target/etc/hostname
-
 if [ "$FAI_ACTION" = "softupdate" ] ; then
 if [ "$FAI_ACTION" = "softupdate" ] ; then
-   echo "Softupdate of FAI via grml-live running"
+   echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running"
 
    if [ -r /etc/resolv.conf ] ; then
       if [ -r $target/etc/resolvconf/run/resolv.conf ] ; then
 
    if [ -r /etc/resolv.conf ] ; then
       if [ -r $target/etc/resolvconf/run/resolv.conf ] ; then
@@ -44,13 +35,6 @@ if [ "$FAI_ACTION" = "softupdate" ] ; then
 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
 EOF
 
 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
 EOF
 
-   # make sure we can handle kernel upgrades:
-   if [ -r $target/etc/kernel-img.conf ] ; then
-      if ! grep -q "silent_modules = Yes" $target/etc/kernel-img.conf ; then
-         echo "silent_modules = Yes" >> $target/etc/kernel-img.conf
-      fi
-   fi
-
    # FAI softupdate executes upgrade only with the sources.list being
    # present in the chroot - so let's do it on our own:
    if [ -r /etc/grml/fai/apt/sources.list ] ; then
    # FAI softupdate executes upgrade only with the sources.list being
    # present in the chroot - so let's do it on our own:
    if [ -r /etc/grml/fai/apt/sources.list ] ; then
@@ -100,53 +84,24 @@ EOF
       APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD apt-get -y upgrade
    fi
 
       APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD apt-get -y upgrade
    fi
 
-else # no softupdate but fresh installation
-
-# install all apt related files
-fcopy -r /etc/apt
-
-# remove grml-live's sources.list file from chroot:
-if [ -r $target/etc/apt/important_note.txt ] ; then
-   grep -q GRML_LIVE_SOURCES $target/etc/apt/important_note.txt && rm $target/etc/apt/important_note.txt
-fi
-
-# install grml gpg key:
-fcopy /etc/apt/grml.key
-$ROOTCMD apt-key add /etc/apt/grml.key
-#   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 the file exists
-[ -e $target/etc/apt/apt.conf ] || touch $target/etc/apt/apt.conf
-
-# work around http://trac.lighttpd.net/trac/ticket/657
-if ! grep -q 'Acquire::http::Pipeline-Depth.*0' $target/etc/apt/apt.conf ; then
-   echo "Acquire::http::Pipeline-Depth 0; // added by grml-live" >> $target/etc/apt/apt.conf
+   exit # make sure we don't continue behind the following "fi"
 fi
 
 fi
 
-# Recommends just pull in way tooooo much packages, so disable it:
-if ! grep -q 'APT::Install-Recommends.*false' $target/etc/apt/apt.conf ; then
-   echo "APT::Install-Recommends false; // added by grml-live"   >> $target/etc/apt/apt.conf
-fi
+# no softupdate but fresh installation
+echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running"
 
 
-# Notice: deprecated with aptitude (0.4.11-1):
-if ! grep -q 'Aptitude::Recommends-Important.*false' $target/etc/apt/apt.conf ; then
-   echo "Aptitude::Recommends-Important false; // added by grml-live" >> $target/etc/apt/apt.conf
+# 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
 fi
 
 fi
 
-# 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."
-  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
+# newer aptitude versions won't remove essential packages using
+# 'aptitude -f -y install file-rc' anymore, therefore force it via:
+$ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
 # }}}
 
 # get rid of insserv:
 # }}}
 
 # get rid of insserv:
@@ -176,7 +131,5 @@ if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then
    $ROOTCMD dpkg-divert --package fai --rename --remove /usr/sbin/invoke-rc.d
 fi
 
    $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
 ## END OF FILE #################################################################
 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3
index cef16c0..b063b50 100755 (executable)
@@ -1,12 +1,25 @@
 #!/bin/bash
 # Filename:      /etc/grml/fai/config/hooks/updatebase.GRMLBASE
 #!/bin/bash
 # Filename:      /etc/grml/fai/config/hooks/updatebase.GRMLBASE
-# Purpose:       skip task updatebase of FAI when running softupdate
+# Purpose:       Updates the base packages of the system, prepare chroot for instsoft
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2 or any later version.
 ################################################################################
 
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2 or any later version.
 ################################################################################
 
+set -u
+set -e
+
+# visualize chroot inside zsh:
+echo grml_chroot > $target/etc/debian_chroot
+
+HOSTNAME=''
+[ -r /etc/grml/grml-live.conf ]  && . /etc/grml/grml-live.conf
+[ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
+[ -n "$HOSTNAME" ] || HOSTNAME=grml
+echo "$HOSTNAME" > $target/etc/hostname
+
 if [ "$FAI_ACTION" = "softupdate" ] ; then
 if [ "$FAI_ACTION" = "softupdate" ] ; then
+   echo "Action $FAI_ACTION of FAI (hooks/updatebase.GRMLBASE) via grml-live running"
 
    ## we want to use our own sources.list:
    skiptask updatebase
 
    ## we want to use our own sources.list:
    skiptask updatebase
@@ -34,7 +47,11 @@ EOF
    # skip the task if we want to build a new ISO only:
    [ -n "$BUILD_ONLY" ] && skiptask instsoft || /bin/true
 
    # skip the task if we want to build a new ISO only:
    [ -n "$BUILD_ONLY" ] && skiptask instsoft || /bin/true
 
-else # no softupdate but updating chroot based on /etc/grml/fai/config/basefiles/*
+   exit # make sure we don't continue behind the following "fi"
+fi
+
+# no softupdate but updating chroot e.g. based on /etc/grml/fai/config/basefiles/*
+echo "Action $FAI_ACTION of FAI (hooks/updatebase.GRMLBASE) via grml-live running"
 
 # install all apt related files
 fcopy -r /etc/apt
 
 # install all apt related files
 fcopy -r /etc/apt
@@ -48,7 +65,5 @@ fi
 fcopy /etc/apt/grml.key
 $ROOTCMD apt-key add /etc/apt/grml.key
 
 fcopy /etc/apt/grml.key
 $ROOTCMD apt-key add /etc/apt/grml.key
 
-fi # softupdate check
-
 ## END OF FILE #################################################################
 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3
 ## END OF FILE #################################################################
 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3
index ef117ae..da74934 100755 (executable)
@@ -9,27 +9,16 @@
 set -u
 set -e
 
 set -u
 set -e
 
-# Restore usual Debian behaviour which has been changed
-# for FAI via /etc/grml/fai/config/hooks/instsoft.GRMLBASE
-if [ -r $target/etc/apt/apt.conf ] ; then
-   sed -i "s#^Acquire::http::Pipeline-Depth.*#// &#"  $target/etc/apt/apt.conf
-   sed -i "s#^APT::Install-Recommends.*#// &#"        $target/etc/apt/apt.conf
-   # Notice: deprecated since aptitude (0.4.11-1):
-   sed -i "s#^Aptitude::Recommends-Important.*#// &#" $target/etc/apt/apt.conf
-fi
+# Restore usual Debian behaviour
+#if [ -r "$target"/etc/apt/apt.conf.d/15grml-live ] ; then
+#   rm -f "$target"/etc/apt/apt.conf.d/15grml-live
+#fi
 
 # Restore original state from softupdate:
 if [ -r $target/etc/policy-rc.d.conf ] ; then
    sed -i "s/EXITSTATUS='101'/EXITSTATUS='0'/" $target/etc/policy-rc.d.conf
 fi
 
 
 # Restore original state from softupdate:
 if [ -r $target/etc/policy-rc.d.conf ] ; then
    sed -i "s/EXITSTATUS='101'/EXITSTATUS='0'/" $target/etc/policy-rc.d.conf
 fi
 
-# Restore usual behaviour:
-if [ -r $target/etc/kernel-img.conf ] ; then
-   if grep -q "silent_modules = Yes" $target/etc/kernel-img.conf ; then
-      sed -i "s/silent_modules = Yes/# &/" $target/etc/kernel-img.conf
-   fi
-fi
-
 # remove an existing /etc/debian_chroot file:
 if [ -r $target/etc/debian_chroot ] ; then
    rm -f $target/etc/debian_chroot
 # remove an existing /etc/debian_chroot file:
 if [ -r $target/etc/debian_chroot ] ; then
    rm -f $target/etc/debian_chroot