rework sources setup (deprecated GRML_LIVE_SOURCES, install /etc/apt files recursively)
authorMichael Prokop <mika@grml.org>
Sat, 26 Nov 2011 10:33:41 +0000 (11:33 +0100)
committerMichael Prokop <mika@grml.org>
Sat, 26 Nov 2011 10:50:18 +0000 (11:50 +0100)
Finally this should give us a FAI setup without having to
generate sources.list configurations on-the-fly any longer.

TODO
docs/grml-live.txt
etc/grml/fai/config/hooks/updatebase.GRMLBASE
etc/grml/grml-live.conf
grml-live

diff --git a/TODO b/TODO
index 84b9af5..1451ccd 100644 (file)
--- a/TODO
+++ b/TODO
@@ -15,9 +15,6 @@ Patches, ideas and feedback welcome.
 
 * add support for ppc?
 
 
 * add support for ppc?
 
-* check out how FAI_DEBMIRROR of /etc/grml/fai/fai.conf could be merged with our
-  MIRROR_DIRECTORY and MIRROR_SOURCES feature of /etc/grml/grml-live.conf
-
 * support multiple kernel versions installed in one single live-system
 
 * Provide different interfaces for easy and common use of grml-live:
 * support multiple kernel versions installed in one single live-system
 
 * Provide different interfaces for easy and common use of grml-live:
index 02b3265..eee2d2f 100644 (file)
@@ -922,27 +922,18 @@ own. Usage example:
 Can I use my own (local) Debian mirror?
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Can I use my own (local) Debian mirror?
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Sure. Just adjust the variables GRML_LIVE_SOURCES and FAI_DEBOOTSTRAP (if not
-already using NFSROOT's base.tgz) inside /etc/grml/grml-live.conf according to
-your needs. Please don't forget that you should use the grml servers as well
-(see default configuration) so all the grml packages can be downloaded as well.
+Yes. Set up an according sources.list configuration as class file in
+${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list.d/ and adjust the variable
+FAI_DEBOOTSTRAP (if not already using NFSROOT's base.tgz) inside
+/etc/grml/grml-live.conf[.local]. If you're setting up your own class file don't
+forget to include the class name in the class list (grml-live -c ...).
 
 
-If you want to use a local (for example NFS mount) mirror additionally, just
-adjust MIRROR_DIRECTORY and MIRROR_SOURCES inside /etc/grml/grml-live.conf as
-well.
-
-Unless you specify GRML_LIVE_SOURCES and/or FAI_DEBOOTSTRAP the default from
-${GRML_FAI_CONFIG}/apt/sources.list and ${GRML_FAI_CONFIG}/make-fai-nfsroot.conf will be
-taken. If you customise the variables in /etc/grml/grml-live.conf then the two
-files will be adjusted during runtime automatically.
-
-If MIRROR_DIRECTORY and MIRROR_SOURCES are specified the local mirror will be
-taken as first entry in the generated sources.list so it's preferred over
-non-local mirrors. Using a fallback mirror (via providing several mirrors in
-GRML_LIVE_SOURCES as used by default) is a recommended setting.
+If you want to use a local (for example NFS mount) mirror additionally then
+adjust MIRROR_DIRECTORY in /etc/grml/grml-live.conf[.local] as well.
 
 If you want to use a HTTP Proxy (like apt-cacher-ng), set APT_PROXY. Example:
 
 If you want to use a HTTP Proxy (like apt-cacher-ng), set APT_PROXY. Example:
-APT_PROXY="http://localhost:3142/"
+
+  APT_PROXY="http://localhost:3142/"
 
 [[add-additional-debian-packages]]
 How do I add additional Debian package(s) to my CD/ISO?
 
 [[add-additional-debian-packages]]
 How do I add additional Debian package(s) to my CD/ISO?
index 930ecbd..c7f343c 100755 (executable)
@@ -70,14 +70,7 @@ if ! [ -e ${target}/etc/udev/kernel-upgrade ] ; then
 fi
 
 # install all apt related files
 fi
 
 # install all apt related files
-fcopy -v /etc/apt/grml.key
-fcopy -v /etc/apt/preferences
-fcopy -v /etc/apt/apt.conf.d/20pdiffs
-fcopy -v /etc/apt/apt.conf.d/15grml-live
-
-# this is the auto-generated sources.list file by grml-live,
-# will be overriden by $GRML_FAI_CONFIG/scripts/GRMLBASE/33-aptsetup
-fcopy -v -c GRML_LIVE_SOURCES_LIST /etc/apt/sources.list
+fcopy -v -r /etc/apt
 
 # install Grml gpg key:
 $ROOTCMD apt-key add /etc/apt/grml.key
 
 # install Grml gpg key:
 $ROOTCMD apt-key add /etc/apt/grml.key
index 63acc99..a1aa84a 100644 (file)
 # architecture (I386 for x86; AMD64 for x86_64)
 # CLASSES="GRMLBASE,GRML_MEDIUM,I386"
 
 # architecture (I386 for x86; AMD64 for x86_64)
 # CLASSES="GRMLBASE,GRML_MEDIUM,I386"
 
-## Which mirrors do you want to use? Please set GRML_LIVE_SOURCES *and*
-## *FAI_DEBOOTSTRAP* accordingly. To use a local directory (like an NFS mount)
-## check out MIRROR_DIRECTORY and MIRROR_SOURCES as well.
-
-# Which Debian mirror do you want to use for main packages (after debootstrapping
-# has been finished)?
-# If you do *not* set GRML_LIVE_SOURCES here then grml-live will just take what
-# ${GRML_FAI_CONFIG}/apt/sources.list provides by default. But please do *not*
-# manually edit ${GRML_FAI_CONFIG}/apt/sources.list but instead use $GRML_LIVE_SOURCES.
-# Use the variable as your /etc/apt/sources.list looks like.
-# GRML_LIVE_SOURCES="
-#deb http://deb.grml.org/            grml-stable  main
-#deb http://deb.grml.org/            grml-testing main
-#deb http://192.168.1.112/debian     lenny     main contrib non-free
-#deb http://cdn.debian.net/debian etch         main contrib non-free
-#"
-
 # HTTP Proxy to use for APT
 # APT_PROXY="http://localhost:3142/"
 
 # HTTP Proxy to use for APT
 # APT_PROXY="http://localhost:3142/"
 
 # Usage: "<suite> <mirror>"
 # FAI_DEBOOTSTRAP="squeeze http://cdn.debian.net/debian"
 
 # Usage: "<suite> <mirror>"
 # FAI_DEBOOTSTRAP="squeeze http://cdn.debian.net/debian"
 
-# Do you want to use a local mirror (like NFS) as well?
+# Do you want to use a local mirror (like NFS)?
 # If so specify the directory where debian/ is available:
 # MIRROR_DIRECTORY="/mnt/mirror"
 # If so specify the directory where debian/ is available:
 # MIRROR_DIRECTORY="/mnt/mirror"
-# ... and the sources.list entry for the directory:
-# MIRROR_SOURCES="deb file:///mnt/mirror/debian sid main contrib non-free"
+# ... and then set up an according class file in
+# ${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list.d/
+# containing something like:
+# deb file:///mnt/mirror/debian sid main contrib non-free
 
 # Version number of ISO:
 # VERSION="0.0-1"
 
 # Version number of ISO:
 # VERSION="0.0-1"
index 04b30bb..eacc570 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -284,6 +284,12 @@ if [ -r "$LOCAL_CONFIG" ] ; then
 else
    LOCAL_CONFIG=''
 fi
 else
    LOCAL_CONFIG=''
 fi
+
+if [ -n "${GRML_LIVE_SOURCES:-}" ] ; then
+  eerror "Config variable \$GRML_LIVE_SOURCES is set. This variable has been deprecated."
+  ewarn  "Please set up ${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list.d/* instead."
+  bailout 1
+fi
 # }}}
 
 # command line parsing {{{
 # }}}
 
 # command line parsing {{{
@@ -334,7 +340,6 @@ shift $(($OPTIND - 1))  # set ARGV to the first not parsed commandline parameter
 [ -n "$HYBRID_METHOD" ]           || HYBRID_METHOD='manifold'
 [ -n "$NFSROOT_CONF" ]            || NFSROOT_CONF="${GRML_FAI_CONFIG}/make-fai-nfsroot.conf"
 [ -n "$RELEASENAME" ]             || RELEASENAME='grml-live rocks'
 [ -n "$HYBRID_METHOD" ]           || HYBRID_METHOD='manifold'
 [ -n "$NFSROOT_CONF" ]            || NFSROOT_CONF="${GRML_FAI_CONFIG}/make-fai-nfsroot.conf"
 [ -n "$RELEASENAME" ]             || RELEASENAME='grml-live rocks'
-[ -n "$SOURCES_LIST_OUTPUT" ]     || SOURCES_LIST_OUTPUT="${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list/GRML_LIVE_SOURCES_LIST"
 [ -n "$SQUASHFS_EXCLUDES_FILE" ]  || SQUASHFS_EXCLUDES_FILE="${GRML_FAI_CONFIG}/config/grml/squashfs-excludes"
 [ -n "$SUITE" ]                   || SUITE='squeeze'
 [ -n "$TEMPLATE_DIRECTORY" ]      || TEMPLATE_DIRECTORY='/usr/share/grml-live/templates'
 [ -n "$SQUASHFS_EXCLUDES_FILE" ]  || SQUASHFS_EXCLUDES_FILE="${GRML_FAI_CONFIG}/config/grml/squashfs-excludes"
 [ -n "$SUITE" ]                   || SUITE='squeeze'
 [ -n "$TEMPLATE_DIRECTORY" ]      || TEMPLATE_DIRECTORY='/usr/share/grml-live/templates'
@@ -492,23 +497,6 @@ einfo "Logging actions to logfile $LOGFILE"
 # }}}
 
 # on-the-fly configuration {{{
 # }}}
 
 # on-the-fly configuration {{{
-mkdir -p "$(dirname $SOURCES_LIST_OUTPUT)" # might not be present in -D config space
-
-cat > "$SOURCES_LIST_OUTPUT" << EOF
-# NOTE: This file is *NOT* meant for manual customisation! This file is
-# installed temporarily only by grml-live and will be overriden in the
-# installation and configuration process then.
-EOF
-
-if [ -n "$MIRROR_DIRECTORY" ] ; then
-  if ! [ -d "$MIRROR_DIRECTORY/debian" ] ; then
-    log    "Error: $MIRROR_DIRECTORY/debian does not seem to exist. Exiting. [$(date)]"
-    eerror "Error: $MIRROR_DIRECTORY/debian does not seem to exist. Exiting." ; eend 1
-    bailout 1
-  fi
-  echo "$MIRROR_SOURCES" >> "$SOURCES_LIST_OUTPUT"
-fi
-
 if [ -n "$FAI_DEBOOTSTRAP" ] ; then
   sed "s#^FAI_DEBOOTSTRAP=.*#FAI_DEBOOTSTRAP=\"$FAI_DEBOOTSTRAP\"#" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
 fi
 if [ -n "$FAI_DEBOOTSTRAP" ] ; then
   sed "s#^FAI_DEBOOTSTRAP=.*#FAI_DEBOOTSTRAP=\"$FAI_DEBOOTSTRAP\"#" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
 fi
@@ -516,50 +504,11 @@ fi
 # does this suck? YES!
 # /usr/share/debootstrap/scripts/unstable does not exist, instead use 'sid':
 case $SUITE in
 # does this suck? YES!
 # /usr/share/debootstrap/scripts/unstable does not exist, instead use 'sid':
 case $SUITE in
-   unstable) SUITE='sid' ;;
-   # make sure that we *NEVER* write any broken suite name to sources.list,
-   # otherwise we won't be able to adjust it one next (correct) execution
-   stable)   ;;
-   testing)  ;;
-   etch)     ;;
-   lenny)    ;;
-   squeeze)  ;;
-   wheezy)   ;;
-   sid)      ;;
-   *) echo "Sorry, $SUITE is not a valid Debian suite, exiting.">&2; bailout 1 ;;
+   unstable) SUITE='sid' ; CLASSES="DEBIAN_UNSTABLE,$CLASSES" ;;
+   *) CLASSES="DEBIAN_$(echo $SUITE | tr 'a-z' 'A-Z'),$CLASSES";;
 esac
 export SUITE # make sure it's available in FAI scripts
 
 esac
 export SUITE # make sure it's available in FAI scripts
 
-if [ -n "${GRML_LIVE_SOURCES:-}" ] ; then
-  DIST=" etch\| stable\| lenny\| squeeze\| wheezy\| testing\| sid\| unstable"
-  echo "# generated based on \$GRML_LIVE_SOURCES by grml-live
-$GRML_LIVE_SOURCES" | \
-    sed -e "s/\(^deb .\+\)\([ \t]*\)\($DIST\)\([ \t]*\)\(main \)/\1 \2$SUITE\4\5/;
-            s/\(^deb-src .\+\)\([ \t]*\)\($DIST\)\([ \t]*\)\(main \)/\1 \2$SUITE\4\5/" >> "$SOURCES_LIST_OUTPUT"
-else
-  cat >> "$SOURCES_LIST_OUTPUT" << EOF
-# generated by grml-live
-deb     http://deb.grml.org/            grml-stable  main
-deb-src http://deb.grml.org/            grml-stable  main
-
-deb     http://deb.grml.org/            grml-testing main
-deb-src http://deb.grml.org/            grml-testing main
-
-deb     http://cdn.debian.net/debian $SUITE  main contrib non-free
-deb-src http://cdn.debian.net/debian $SUITE  main contrib non-free
-EOF
-fi
-
-# notice: activate grml-live pool when building against unstable or testing:
-if grep -qwe unstable -qwe sid -qwe testing -qwe wheezy "$SOURCES_LIST_OUTPUT" ; then
-   grep -q 'grml-live.*main' "$SOURCES_LIST_OUTPUT" || \
-   grep grml-stable "$SOURCES_LIST_OUTPUT" | \
-        sed 's/grml-stable/grml-live/' >> "$SOURCES_LIST_OUTPUT"
-else
-   grep -q 'grml-live.*main' "$SOURCES_LIST_OUTPUT" && \
-   sed -i 's/.*grml-live.*main/# removed grml-live repository/' "$SOURCES_LIST_OUTPUT"
-fi
-
 for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" "$NFSROOT_CONF" ; do
     if [ -n "$file" ] ; then
        sed "s|^FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$file" | sponge "$file"
 for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" "$NFSROOT_CONF" ; do
     if [ -n "$file" ] ; then
        sed "s|^FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$file" | sponge "$file"