Split /etc/apt/sources.list file into structured files in /etc/apt/sources.list.d/
authorMichael Prokop <mika@grml.org>
Wed, 5 Aug 2009 00:28:25 +0000 (02:28 +0200)
committerMichael Prokop <mika@grml.org>
Wed, 5 Aug 2009 01:27:08 +0000 (03:27 +0200)
debian/changelog
etc/grml/fai/config/hooks/instsoft.GRMLBASE
etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup
grml-live

index da45dab..6181bd7 100644 (file)
@@ -1,3 +1,13 @@
+grml-live (0.9.21) UNRELEASED; urgency=low
+
+  * Split the single /etc/apt/sources.list file into structured files
+    in /etc/apt/sources.list.d/. We are using:
+    - /etc/apt/sources.list.d/grml.list for all grml related repositories
+    - /etc/apt/sources.list.d/debian.list for official Debian repositories
+    [Testing: issue349]
+
+ -- Michael Prokop <mika@grml.org>  Wed, 05 Aug 2009 02:23:29 +0200
+
 grml-live (0.9.20) unstable; urgency=low
 
   * Add gnupg2 to GRML_FULL. Thanks to Walter Haidinger.
@@ -63,7 +73,7 @@ grml-live (0.9.19) unstable; urgency=low
      that have been removed from GRML_FULL.
   * Software related changes in GRML_FORENSIC:
     - drop stegdetect (see #507908)
-    - add several further packages: 
+    - add several further packages:
       acpi apache2 apache2-utils at bluez-utils cpufrequtils cryptcat
       cups cups-pdf dc dsniff dvd+rw-tools gphoto2 hdparm hping3
       mysql-client netdiscover nmap os-prober poppler-utils pppconfig
@@ -89,7 +99,7 @@ grml-live (0.9.18) unstable; urgency=low
   * Apply patches by Thorsten Glaser <tg@mirbsd.org>:
     - Fix jumping back from the bsd4grml loader (ldbsd.com) to GNU GRUB
     - Update bootgrub.mksh from MirBSD
-    - Pad official ISOs to multiples of 256 KiB for partition table support. 
+    - Pad official ISOs to multiples of 256 KiB for partition table support.
   * Add bc to Depends as bootgrub.mksh requires it.
 
  -- Michael Prokop <mika@grml.org>  Sat, 13 Jun 2009 12:11:19 +0200
index 4e94d66..213f39c 100755 (executable)
@@ -57,7 +57,7 @@ EOF
       if [ -L $target/etc/apt/sources.list ] ; then
          rm $target/etc/apt/sources.list
       fi
-      cp /etc/grml/fai/apt/sources.list $target/etc/apt/sources.list
+      cp /etc/grml/fai/apt/sources.list $target/etc/apt/sources.list.d/grml-live.list
    fi
 
    # run it on our own, as updatebase is used at the wrong stage for our needs,
index efb6cbd..9cfbd29 100755 (executable)
@@ -6,24 +6,75 @@
 # License:       This file is licensed under the GPL v2 or any later version.
 ################################################################################
 
-set -u
 set -e
 
-rm -f $target/etc/apt/sources.list
+# remove leftover from /etc/grml/fai/config/hooks/instsoft.GRMLBASE:
+rm -f $target/etc/apt/sources.list.d/grml-live.list
 
-$ROOTCMD ln -s /etc/apt/sources.list.grml /etc/apt/sources.list
+GRML_SOURCES_LIST="$target/etc/apt/sources.list.d/grml.list"
+DEBIAN_SOURCES_LIST="$target/etc/apt/sources.list.d/debian.list"
 
-# if we have a devel-version or a daily snapshot
-# let's activate grml-testing by default:
+[ -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/grml-live-build-info ] ; then
+  . $target/etc/grml/grml-live-build-info
+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:
+  deb     http://ftp.de.debian.org/debian/ $SUITE main contrib non-free
+  deb-src http://ftp.de.debian.org/debian/ $SUITE 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 [ -n "$GRML_NAME" -o -n "$RELEASENAME" ] ; then
    if echo "$GRML_NAME" "$RELEASENAME" | grep -e devel -e autobuild 1>/dev/null ; then
-      sed -i 's|^#\(.*deb.*deb.grml.org.*grml-testing\)|\1|' "$target"/etc/apt/sources.list
+      ENABLE_GRML_TESTING=true
    fi
 fi
 
-#if [ -r /etc/grml/fai/files/etc/apt/preferences ] ; then
-#   cp /etc/grml/fai/files/etc/apt/preferences $target/etc/apt/preferences
-#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
+fi
 
 ## END OF FILE #################################################################
 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3
index 6e4522c..f100066 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -447,6 +447,12 @@ if [ -n "$BUILD_DIRTY" ]; then
 else
    [ -n "$CHROOT_OUTPUT" ] || CHROOT_OUTPUT="$OUTPUT/grml_chroot"
 
+   # inform fai about the suite we build
+   if [ -n "$SUITE" ] ; then
+      [ -d "$CHROOT_OUTPUT/etc/grml" ] || mkdir -p "$CHROOT_OUTPUT/etc/grml"
+      echo "SUITE=$SUITE" > "$CHROOT_OUTPUT/etc/grml/grml-live-build-info"
+   fi
+
    if [ -n "$UPDATE" -o -n "$BUILD_ONLY" ] ; then
       FAI_ACTION=softupdate
    else