From a242e27306035a23c96bf5b07b0840942ed245fb Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 8 Jul 2011 01:34:11 +0200 Subject: [PATCH] Redesign sources.list handling. Get rid of /etc/grml/fai/apt/sources.list. Main changes: * no longer recursively deploy /etc/apt via fcopy * /etc/grml/fai/apt/sources.list is gone * /etc/apt/sources.list will no longer use entries from GRML_LIVE_SOURCES once the system has been initially installed More details: As we get rid of /etc/grml/fai/apt/sources.list we finally manage to no longer magically touch grml-live's configuration files WRT sources.list handling. Instead the set up of sources.list happens as follows: ${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list/GRML_LIVE_SOURCES_LIST is generated based on $GRML_LIVE_SOURCES (iff set by the user, otherwise it falls back to sane defaults using grml repos and the according Debian suite). This GRML_LIVE_SOURCES_LIST file then gets deployed on *fresh* deployments. It won't be reused anymore for the existing installation, so if you run grml-live with the "-u" option the system will keep /etc/apt/sources.list as it is as well as the files inside /etc/apt/sources.list.d/. This provides more flexibility combined with a more transparent and consistent behaviour for the user. Then /etc/apt/sources.list.d/debian.list will be set up based on the detected Debian suite and the files from ${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_*. Finally /etc/apt/sources.list/grml-stable.list will be deployed and depending on the build type also /etc/apt/sources.list.d/grml-testing.list might be installed. --- etc/grml/fai/apt/sources.list | 9 -- .../etc/apt/sources.list.d/debian.list/DEBIAN_ETCH | 15 +++ .../apt/sources.list.d/debian.list/DEBIAN_LENNY | 15 +++ .../etc/apt/sources.list.d/debian.list/DEBIAN_SID | 15 +++ .../apt/sources.list.d/debian.list/DEBIAN_SQUEEZE | 15 +++ .../apt/sources.list.d/debian.list/DEBIAN_STABLE | 15 +++ .../apt/sources.list.d/debian.list/DEBIAN_TESTING | 15 +++ .../apt/sources.list.d/debian.list/DEBIAN_WHEEZY | 15 +++ .../apt/sources.list.d/grml-stable.list/GRMLBASE | 3 + .../apt/sources.list.d/grml-testing.list/GRMLBASE | 3 + .../fai/config/files/etc/apt/sources.list/GRMLBASE | 9 ++ etc/grml/fai/config/hooks/instsoft.GRMLBASE | 19 ---- etc/grml/fai/config/hooks/updatebase.GRMLBASE | 9 +- etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup | 104 +++++---------------- grml-live | 43 ++++----- 15 files changed, 174 insertions(+), 130 deletions(-) delete mode 100644 etc/grml/fai/apt/sources.list create mode 100644 etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_ETCH create mode 100644 etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_LENNY create mode 100644 etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SID create mode 100644 etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SQUEEZE create mode 100644 etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE create mode 100644 etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING create mode 100644 etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_WHEEZY create mode 100644 etc/grml/fai/config/files/etc/apt/sources.list.d/grml-stable.list/GRMLBASE create mode 100644 etc/grml/fai/config/files/etc/apt/sources.list.d/grml-testing.list/GRMLBASE create mode 100644 etc/grml/fai/config/files/etc/apt/sources.list/GRMLBASE diff --git a/etc/grml/fai/apt/sources.list b/etc/grml/fai/apt/sources.list deleted file mode 100644 index 95f030b..0000000 --- a/etc/grml/fai/apt/sources.list +++ /dev/null @@ -1,9 +0,0 @@ -# NOTE: This file is used as input file for generating -# ${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list/GRMLBASE -# which is copied to /etc/apt/sources.list to the chroot. -# Do *NOT* modify this file directly but instead consider using -# GRML_LIVE_SOURCES in /etc/grml/grml-live.conf* or FAI's -# fcopy command with ${GRML_FAI_CONFIG}/config/files instead! -deb http://deb.grml.org/ grml-stable main -deb http://deb.grml.org/ grml-testing main -deb http://cdn.debian.net/debian squeeze main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_ETCH b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_ETCH new file mode 100644 index 0000000..06ce943 --- /dev/null +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_ETCH @@ -0,0 +1,15 @@ +# official debian repository (mirror selected via geo-ip): + deb http://cdn.debian.net/debian/ etch main contrib non-free +# deb-src http://cdn.debian.net/debian/ etch main contrib non-free + +# official debian repository: +# deb http://ftp.debian.org/debian/ etch main contrib non-free +# deb-src http://ftp.debian.org/debian/ etch main contrib non-free + +# official debian DE repository: +# deb http://ftp.de.debian.org/debian/ etch main contrib non-free +# deb-src http://ftp.de.debian.org/debian/ etch main contrib non-free + +# official debian AT repository: +# deb http://ftp.at.debian.org/debian/ etch main contrib non-free +# deb-src http://ftp.at.debian.org/debian/ etch main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_LENNY b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_LENNY new file mode 100644 index 0000000..ec0d7ca --- /dev/null +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_LENNY @@ -0,0 +1,15 @@ +# official debian repository (mirror selected via geo-ip): + deb http://cdn.debian.net/debian/ lenny main contrib non-free +# deb-src http://cdn.debian.net/debian/ lenny main contrib non-free + +# official debian repository: +# deb http://ftp.debian.org/debian/ lenny main contrib non-free +# deb-src http://ftp.debian.org/debian/ lenny main contrib non-free + +# official debian DE repository: +# deb http://ftp.de.debian.org/debian/ lenny main contrib non-free +# deb-src http://ftp.de.debian.org/debian/ lenny main contrib non-free + +# official debian AT repository: +# deb http://ftp.at.debian.org/debian/ lenny main contrib non-free +# deb-src http://ftp.at.debian.org/debian/ lenny main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SID b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SID new file mode 100644 index 0000000..cfef9b3 --- /dev/null +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SID @@ -0,0 +1,15 @@ +# official debian repository (mirror selected via geo-ip): + deb http://cdn.debian.net/debian/ sid main contrib non-free +# deb-src http://cdn.debian.net/debian/ sid main contrib non-free + +# official debian repository: +# deb http://ftp.debian.org/debian/ sid main contrib non-free +# deb-src http://ftp.debian.org/debian/ sid main contrib non-free + +# official debian DE repository: +# deb http://ftp.de.debian.org/debian/ sid main contrib non-free +# deb-src http://ftp.de.debian.org/debian/ sid main contrib non-free + +# official debian AT repository: +# deb http://ftp.at.debian.org/debian/ sid main contrib non-free +# deb-src http://ftp.at.debian.org/debian/ sid main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SQUEEZE b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SQUEEZE new file mode 100644 index 0000000..059ad7f --- /dev/null +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SQUEEZE @@ -0,0 +1,15 @@ +# official debian repository (mirror selected via geo-ip): + deb http://cdn.debian.net/debian/ squeeze main contrib non-free +# deb-src http://cdn.debian.net/debian/ squeeze main contrib non-free + +# official debian repository: +# deb http://ftp.debian.org/debian/ squeeze main contrib non-free +# deb-src http://ftp.debian.org/debian/ squeeze main contrib non-free + +# official debian DE repository: +# deb http://ftp.de.debian.org/debian/ squeeze main contrib non-free +# deb-src http://ftp.de.debian.org/debian/ squeeze main contrib non-free + +# official debian AT repository: +# deb http://ftp.at.debian.org/debian/ squeeze main contrib non-free +# deb-src http://ftp.at.debian.org/debian/ squeeze main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE new file mode 100644 index 0000000..aab5be1 --- /dev/null +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE @@ -0,0 +1,15 @@ +# official debian repository (mirror selected via geo-ip): + deb http://cdn.debian.net/debian/ stable main contrib non-free +# deb-src http://cdn.debian.net/debian/ stable main contrib non-free + +# official debian repository: +# deb http://ftp.debian.org/debian/ stable main contrib non-free +# deb-src http://ftp.debian.org/debian/ stable main contrib non-free + +# official debian DE repository: +# deb http://ftp.de.debian.org/debian/ stable main contrib non-free +# deb-src http://ftp.de.debian.org/debian/ stable main contrib non-free + +# official debian AT repository: +# deb http://ftp.at.debian.org/debian/ stable main contrib non-free +# deb-src http://ftp.at.debian.org/debian/ stable main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING new file mode 100644 index 0000000..895974a --- /dev/null +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING @@ -0,0 +1,15 @@ +# official debian repository (mirror selected via geo-ip): + deb http://cdn.debian.net/debian/ testing main contrib non-free +# deb-src http://cdn.debian.net/debian/ testing main contrib non-free + +# official debian repository: +# deb http://ftp.debian.org/debian/ testing main contrib non-free +# deb-src http://ftp.debian.org/debian/ testing main contrib non-free + +# official debian DE repository: +# deb http://ftp.de.debian.org/debian/ testing main contrib non-free +# deb-src http://ftp.de.debian.org/debian/ testing main contrib non-free + +# official debian AT repository: +# deb http://ftp.at.debian.org/debian/ testing main contrib non-free +# deb-src http://ftp.at.debian.org/debian/ testing main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_WHEEZY b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_WHEEZY new file mode 100644 index 0000000..0f698c9 --- /dev/null +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_WHEEZY @@ -0,0 +1,15 @@ +# official debian repository (mirror selected via geo-ip): + deb http://cdn.debian.net/debian/ wheezy main contrib non-free +# deb-src http://cdn.debian.net/debian/ wheezy main contrib non-free + +# official debian repository: +# deb http://ftp.debian.org/debian/ wheezy main contrib non-free +# deb-src http://ftp.debian.org/debian/ wheezy main contrib non-free + +# official debian DE repository: +# deb http://ftp.de.debian.org/debian/ wheezy main contrib non-free +# deb-src http://ftp.de.debian.org/debian/ wheezy main contrib non-free + +# official debian AT repository: +# deb http://ftp.at.debian.org/debian/ wheezy main contrib non-free +# deb-src http://ftp.at.debian.org/debian/ wheezy main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-stable.list/GRMLBASE b/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-stable.list/GRMLBASE new file mode 100644 index 0000000..63b4222 --- /dev/null +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-stable.list/GRMLBASE @@ -0,0 +1,3 @@ +# stable Grml repository: + deb http://deb.grml.org/ grml-stable main +# deb-src http://deb.grml.org/ grml-stable main diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-testing.list/GRMLBASE b/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-testing.list/GRMLBASE new file mode 100644 index 0000000..860d528 --- /dev/null +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-testing.list/GRMLBASE @@ -0,0 +1,3 @@ +# testing/developer Grml repository: + deb http://deb.grml.org/ grml-testing main +# deb-src http://deb.grml.org/ grml-testing main diff --git a/etc/grml/fai/config/files/etc/apt/sources.list/GRMLBASE b/etc/grml/fai/config/files/etc/apt/sources.list/GRMLBASE new file mode 100644 index 0000000..84a9c76 --- /dev/null +++ b/etc/grml/fai/config/files/etc/apt/sources.list/GRMLBASE @@ -0,0 +1,9 @@ +################################################################### +# Installed via grml-live's +# ${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list/GRMLBASE +################################################################### + +##### IMPORTANT NOTE ############################################## +# The configuration file /etc/apt/sources.list has been split +# into structured files in directory /etc/apt/sources.list.d +##### IMPORTANT NOTE ############################################## diff --git a/etc/grml/fai/config/hooks/instsoft.GRMLBASE b/etc/grml/fai/config/hooks/instsoft.GRMLBASE index 8600154..fcc2bdb 100755 --- a/etc/grml/fai/config/hooks/instsoft.GRMLBASE +++ b/etc/grml/fai/config/hooks/instsoft.GRMLBASE @@ -9,9 +9,6 @@ set -u set -e -GRML_SOURCES_LIST="$target/etc/apt/sources.list.d/grml.list" -DEBIAN_SOURCES_LIST="$target/etc/apt/sources.list.d/debian.list" - # if hooks/updatebase.GRMLBASE fails for whatever reason # and can't skip instsoft.GRMLBASE we have to make sure # we exit here as well @@ -63,22 +60,6 @@ if [ "$FAI_ACTION" = "softupdate" ] ; then //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2"; EOF - # FAI softupdate executes upgrade only with the sources.list being - # present in the chroot - so let's do it on our own: - fcopy /etc/apt/sources.list - - # when re-running grml-live with the -u option we do not want to use the - # sources.list config of the live system but grml-live's config instead, - # therefore temporarly move known files and restore them again later on - # through /etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup: - if [ -r "$GRML_SOURCES_LIST" ] ; then - mv "$GRML_SOURCES_LIST" "${GRML_SOURCES_LIST}.unused" - fi - - if [ -r "$DEBIAN_SOURCES_LIST" ] ; then - mv "$DEBIAN_SOURCES_LIST" "${DEBIAN_SOURCES_LIST}.unused" - fi - # 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 diff --git a/etc/grml/fai/config/hooks/updatebase.GRMLBASE b/etc/grml/fai/config/hooks/updatebase.GRMLBASE index b49b180..f88f0fb 100755 --- a/etc/grml/fai/config/hooks/updatebase.GRMLBASE +++ b/etc/grml/fai/config/hooks/updatebase.GRMLBASE @@ -64,7 +64,14 @@ if ! [ -e ${target}/etc/udev/kernel-upgrade ] ; then fi # install all apt related files -fcopy -r /etc/apt +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 # install Grml gpg key: $ROOTCMD apt-key add /etc/apt/grml.key diff --git a/etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup b/etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup index e4922a9..56355f5 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup +++ b/etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup @@ -9,90 +9,34 @@ set -u set -e -GRML_SOURCES_LIST="$target/etc/apt/sources.list.d/grml.list" -DEBIAN_SOURCES_LIST="$target/etc/apt/sources.list.d/debian.list" - -# restore original grml sources.list file (temporarly moved via -# /etc/grml/fai/config/hooks/instsoft.GRMLBASE): -if [ -r "${GRML_SOURCES_LIST}.unused" ] ; then - mv "${GRML_SOURCES_LIST}.unused" "${GRML_SOURCES_LIST}" -fi -if [ -r "${DEBIAN_SOURCES_LIST}.unused" ] ; then - mv "${DEBIAN_SOURCES_LIST}.unused" "${DEBIAN_SOURCES_LIST}" +fcopy -v /etc/apt/sources.list +fcopy -v /etc/apt/sources.list.d/grml-stable.list + +case "${SUITE:-}" in + etch) suite_class=DEBIAN_ETCH ;; + lenny) suite_class=DEBIAN_LENNY ;; + squeeze) suite_class=DEBIAN_SQUEEZE ;; + stable) suite_class=DEBIAN_STABLE ;; + testing) suite_class=DEBIAN_TESTING ;; + unstable|sid) suite_class=DEBIAN_SID ;; + wheezy) suite_class=DEBIAN_WHEEZY ;; + *) suite_class=DEBIAN_SID ;; # default to sid otherwise +esac + +if ! [ -r $FAI/files/etc/apt/sources.list.d/debian.list/$suite_class ] ; then + echo "Error: could not find $FAI/files/etc/apt/sources.list.d/debian.list/$suite_class" >&2 + echo "Please provide an according sources.list template." >&2 + exit 1 fi -[ -d $target/etc/apt/sources.list.d ] || mkdir $target/etc/apt/sources.list.d - -# remove any existing sources.list and inform user about the new -# /etc/apt/sources.list.d/ setup: -cat > $target/etc/apt/sources.list << EOF -##### IMPORTANT NOTE ############################################## -# The configuration file /etc/apt/sources.list has been split -# into structured files in /etc/apt/sources.list.d/ - check out: -# -# /etc/apt/sources.list.d/grml.list for the grml related repositories -# /etc/apt/sources.list.d/debian.list for official Debian repositories -# -# If you're looking for the "old" /etc/apt/sources.list file or -# need some further repositories please take a look at the file -# /etc/apt/sources.list.grml -##### IMPORTANT NOTE ############################################## -EOF - -# retrieve build information ($SUITE): -if [ -r $target/etc/grml_live_version ] ; then - . $target/etc/grml_live_version -fi - -# if we stil do not know which Debian suite we are building assume "stable" -[ -n "$SUITE" ] || SUITE="stable" - -# configure official Debian repositories: -cat > "$DEBIAN_SOURCES_LIST" << EOF -# official debian repository (mirror selected via geo-ip): - deb http://cdn.debian.net/debian/ $SUITE main contrib non-free -# deb-src http://cdn.debian.net/debian/ $SUITE main contrib non-free +# install according sources.list, depending on deployed Debian suite +fcopy -v -c $suite_class /etc/apt/sources.list.d/debian.list -# official debian repository: -# deb http://ftp.debian.org/debian/ sid main contrib non-free -# deb-src http://ftp.debian.org/debian/ sid main contrib non-free - -# official debian DE repository: -# deb http://ftp.de.debian.org/debian/ sid main contrib non-free -# deb-src http://ftp.de.debian.org/debian/ sid main contrib non-free - -# official debian AT repository: -# deb http://ftp.at.debian.org/debian/ sid main contrib non-free -# deb-src http://ftp.at.debian.org/debian/ sid main contrib non-free -EOF - -# configure grml-stable repository: -cat > "$GRML_SOURCES_LIST" << EOF -# stable grml repository: - deb http://deb.grml.org/ grml-stable main -# deb-src http://deb.grml.org/ grml-stable main -EOF - -ENABLE_GRML_TESTING=false -# if we have a devel-version or a daily snapshot enable grml-testing by default: +# if we have a devel-version or a daily snapshot enable grml-testing repos: if [ -n "$GRML_NAME" -o -n "$RELEASENAME" ] ; then - if echo "$GRML_NAME" "$RELEASENAME" | grep -e devel -e autobuild 1>/dev/null ; then - ENABLE_GRML_TESTING=true - fi -fi - -if $ENABLE_GRML_TESTING ; then - cat >> "$GRML_SOURCES_LIST" << EOF -# testing/developer grml repository: - deb http://deb.grml.org/ grml-testing main -# deb-src http://deb.grml.org/ grml-testing main -EOF -else # no devel/daily build: - cat >> "$GRML_SOURCES_LIST" << EOF -# testing/developer grml repository: -# deb http://deb.grml.org/ grml-testing main -# deb-src http://deb.grml.org/ grml-testing main -EOF + if echo "$GRML_NAME" "$RELEASENAME" | grep -e devel -e autobuild >/dev/null ; then + fcopy -v /etc/apt/sources.list.d/grml-testing.list + fi fi ## END OF FILE ################################################################# diff --git a/grml-live b/grml-live index 32a88c7..3f5a1c0 100755 --- a/grml-live +++ b/grml-live @@ -273,8 +273,7 @@ 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 "$SOURCES_LIST_INPUT" ] || SOURCES_LIST_INPUT="${GRML_FAI_CONFIG}/apt/sources.list" -[ -n "$SOURCES_LIST_OUTPUT" ] || SOURCES_LIST_OUTPUT="${GRML_FAI_CONFIG}/config/files/etc/apt/sources.list/GRMLBASE" +[ -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' @@ -410,9 +409,8 @@ mkdir -p "$(dirname $SOURCES_LIST_OUTPUT)" # might not be present in -D config s cat > "$SOURCES_LIST_OUTPUT" << EOF # NOTE: This file is *NOT* meant for manual customisation! This file is -# modified by grml-live and any changes will be overridden. -# You might consider using GRML_LIVE_SOURCES in /etc/grml/grml-live.conf* -# or FAI's fcopy command with ${GRML_FAI_CONFIG}/config/files instead! +# installed temporarily only by grml-live and will be overriden in the +# installation and configuration process then. EOF if [ -n "$MIRROR_DIRECTORY" ] ; then @@ -424,10 +422,6 @@ if [ -n "$MIRROR_DIRECTORY" ] ; then echo "$MIRROR_SOURCES" >> "$SOURCES_LIST_OUTPUT" fi -if [ -n "$GRML_LIVE_SOURCES" ] ; then - echo "$GRML_LIVE_SOURCES" >> "$SOURCES_LIST_OUTPUT" -fi - if [ -n "$FAI_DEBOOTSTRAP" ] ; then sed "s#^FAI_DEBOOTSTRAP=.*#FAI_DEBOOTSTRAP=\"$FAI_DEBOOTSTRAP\"#" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF" fi @@ -447,24 +441,31 @@ case $SUITE in sid) ;; *) echo "Sorry, $SUITE is not a valid Debian suite, exiting.">&2; bailout 1 ;; esac - -DIST=" etch\| stable\| lenny\| squeeze\| wheezy\| testing\| sid\| unstable" -sed "s/\(^deb .\+\)\([ \t]*\)\($DIST\)\([ \t]*\)\(main \)/\1 \2$SUITE\4\5/" "$SOURCES_LIST_INPUT" | sponge "$SOURCES_LIST_OUTPUT" -for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do - if [ -n "$file" ] ; then - sed "s/^SUITE=.*/SUITE=\"$SUITE\"/" $file | sponge $file - sed "s/\(^deb .\+\)\([ \t]*\)\($DIST\)\([ \t]*\)\(main \)/\1 \2$SUITE\4\5/" "$file" | sponge "$file" - fi -done +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 http://deb.grml.org/ grml-testing main +deb http://cdn.debian.net/debian $SUITE main contrib non-free +EOF +fi # notice: activate grml-live pool only if we are building against unstable: -if grep -qwe unstable -qwe sid "$SOURCES_LIST_INPUT" ; then +if grep -qwe unstable -qwe sid "$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_INPUT" && \ - sed 's/.*grml-live.*/# removed grml-live repository/' "$SOURCES_LIST_INPUT" | sponge "$SOURCES_LIST_OUTPUT" + 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 -- 2.1.4