Provide wayback machine via "-w <date>"
authorMichael Prokop <mika@grml.org>
Tue, 5 Jan 2016 11:19:19 +0000 (12:19 +0100)
committerMichael Prokop <mika@grml.org>
Tue, 5 Jan 2016 11:51:53 +0000 (12:51 +0100)
The wayback machine provides building the system using Debian
archives from the specified date.

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

index 7e56bbd..4c87d72 100644 (file)
@@ -14,7 +14,7 @@ grml-live [-a <architecture>] [-c <classe[s]>] [-C <configfile>] [
 -e <extract_iso_name>] [-g <grml_name>] [-i <iso_name>] [
 -o <output_directory>] [-r <release_name>] [-s <suite>] [
 -t <template_directory>] [-v <version_number>] [-U <username>] [
--AbBFnNqQuVz]
+-w <date>] [-AbBFnNqQuVz]
 
 Description
 -----------
@@ -232,6 +232,22 @@ Specify version number of the release.
 
 Increase verbosity in the build process.
 
+  -w **DATE**::
+
+The wayback machine. Build the system using Debian archives from the specified
+date.  Valid date formats are yyyymmddThhmmssZ or simply yyyymmdd.  To learn
+which snapshots exist, i.e. which date strings are valid, simply browse the
+lists on http://snapshot.debian.org/.  If there is no import at the exact time
+you specified you will get the latest available timestamp which is before the
+time you specified.
+This option is useful especially for release and debugging builds - for example
+if you know that the Debian archive was in a good state on a specific date but
+you want to build it on another day in the future, where the archive might not
+be as needed anymore. Please be aware that this is restricted to the plain
+Debian repositories only, as referred to in /etc/apt/sources.list.d/debian.list
+(so neither the Grml repositories nor any further custom ones are affected by
+the wayback machine).
+
   -z::
 
 Use ZLIB instead of LZMA/XZ compression in mksquashfs part of the build process.
index 063cae4..93f4428 100755 (executable)
@@ -69,6 +69,17 @@ fi
 # install all apt related files
 fcopy -i -B -v -r /etc/apt
 
+# install packages from a repository of a specific date
+if [ -n "${WAYBACK_DATE:-}" ] ; then
+  echo "Wayback date '$WAYBACK_DATE' identified, enabling for snapshot.debian.org usage."
+
+  perl -pi -e "s#^(\s+)(deb.* )(.*://ftp.debian.org.*?)\s+([a-z-]+)\s+(.*)\$#\$1\$2http://snapshot.debian.org/archive/debian/$WAYBACK_DATE/ \$4 \$5#" \
+    "${target}/etc/apt/sources.list.d/debian.list"
+
+  perl -pi -e "s#^(\s+)(deb.* )(.*://security.debian.org.*?)\s+([a-z-/]+)\s+(.*)\$#\$1\$2http://snapshot.debian.org/archive/debian-security/$WAYBACK_DATE/ \$4 \$5#" \
+    "${target}/etc/apt/sources.list.d/debian.list"
+fi
+
 # install Grml gpg key:
 $ROOTCMD apt-key add /etc/apt/grml.key
 
index 6d02701..23a89d7 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -71,6 +71,8 @@ Usage: $PN [options, see as follows]
    -U <username>           arrange output to be owned by specified username
    -v <version_number>     specify version number of the release
    -V                      increase verbosity in the build process
+   -w <date>               wayback machine, build system using Debian archives
+                           from specified date
    -z                      use ZLIB instead of LZMA/XZ compression
 
 Usage examples:
@@ -311,7 +313,7 @@ copy_addon_file() {
 # }}}
 
 # command line parsing {{{
-while getopts "a:C:c:d:D:e:g:i:I:o:r:s:S:t:U:v:AbBFhnNqQuVz" opt; do
+while getopts "a:C:c:d:D:e:g:i:I:o:r:s:S:t:U:v:w:AbBFhnNqQuVz" opt; do
   case "$opt" in
     a) ARCH="$OPTARG" ;;
     A) CLEAN_ARTIFACTS=1 ;;
@@ -340,6 +342,7 @@ while getopts "a:C:c:d:D:e:g:i:I:o:r:s:S:t:U:v:AbBFhnNqQuVz" opt; do
     u) UPDATE=1 ;;
     U) CHOWN_USER="$OPTARG" ;;
     V) VERBOSE="-v" ;;
+    w) export WAYBACK_DATE="$OPTARG" ;;
     z) SQUASHFS_ZLIB=1 ;;
     ?) echo "invalid option -$OPTARG" >&2; usage; bailout 1 ;;
   esac
@@ -693,7 +696,7 @@ else
       mount --bind "${OUTPUT}/grml_sources/" "${CHROOT_OUTPUT}/grml-live/sources/"
 
       log "Executed FAI command line:"
-      log "BUILD_ONLY=$BUILD_ONLY BOOTSTRAP_ONLY=$BOOTSTRAP_ONLY GRML_LIVE_CONFIG=$CONFIGDUMP fai $VERBOSE -C $GRML_FAI_CONFIG -s file:///$GRML_FAI_CONFIG/config -c$CLASSES -u $HOSTNAME $FAI_ACTION $CHROOT_OUTPUT $FAI_ARGS"
+      log "BUILD_ONLY=$BUILD_ONLY BOOTSTRAP_ONLY=$BOOTSTRAP_ONLY GRML_LIVE_CONFIG=$CONFIGDUMP WAYBACK_DATE=$WAYBACK_DATE fai $VERBOSE -C $GRML_FAI_CONFIG -s file:///$GRML_FAI_CONFIG/config -c$CLASSES -u $HOSTNAME $FAI_ACTION $CHROOT_OUTPUT $FAI_ARGS"
       BUILD_ONLY="$BUILD_ONLY" BOOTSTRAP_ONLY="$BOOTSTRAP_ONLY" GRML_LIVE_CONFIG="$CONFIGDUMP" fai $VERBOSE \
                   -C "$GRML_FAI_CONFIG" -s "file:///$GRML_FAI_CONFIG/config" -c"$CLASSES" \
                   -u "$HOSTNAME" "$FAI_ACTION" "$CHROOT_OUTPUT" $FAI_ARGS | tee -a $LOGFILE