-rm -f $target/etc/apt/sources.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
+# 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.* )(.*://ftp.debian.org.*?)\s+([a-z-]+)\s+(.*)$#$1$2http://snapshot.debian.org/archive/debian/$d/ $4 $5#' \
+ "${target}/etc/apt/sources.list.d/debian.list"