Revert "Replace cdn.debian.net with http.debian.net"
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 33-aptsetup
index 5e5cad7..39af509 100755 (executable)
@@ -1,30 +1,20 @@
-#!/bin/sh
-# Filename:      /etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup
+#!/bin/bash
+# Filename:      ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/33-aptsetup
 # Purpose:       configure Debian package management of live-system
 # 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.
-# Latest change: Sun Sep 28 20:08:30 CEST 2008 [mika]
 ################################################################################
 
-set -u
 set -e
 
-rm -f $target/etc/apt/sources.list
+# use snapshot.debian.org based on build date for release
+if ifclass RELEASE ; then
+  set -u
+  perl -pi -e 'BEGIN { $d="'$(date +%Y%m%d)'"; } s#^(\s+)(deb.* )(.*://cdn.*?)\s+(\w+)\s+(.*)$#$1$2http://snapshot.debian.org/archive/debian/$d/ $4 $5#' \
+    "${target}/etc/apt/sources.list.d/debian.list"
 
-$ROOTCMD ln -s /etc/apt/sources.list.grml /etc/apt/sources.list
-
-# if we have a devel-version or a daily snapshot
-# let's activate 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
-   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
-
 ## END OF FILE #################################################################
-# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3
+# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2