From 7380bbc4746d542bf866249e60b191e13391d0ad Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Tue, 5 Jan 2016 12:19:19 +0100 Subject: [PATCH] Provide wayback machine via "-w " The wayback machine provides building the system using Debian archives from the specified date. --- docs/grml-live.txt | 18 +++++++++++++++++- etc/grml/fai/config/hooks/updatebase.GRMLBASE | 11 +++++++++++ grml-live | 7 +++++-- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/docs/grml-live.txt b/docs/grml-live.txt index 7e56bbd..4c87d72 100644 --- a/docs/grml-live.txt +++ b/docs/grml-live.txt @@ -14,7 +14,7 @@ grml-live [-a ] [-c ] [-C ] [ -e ] [-g ] [-i ] [ -o ] [-r ] [-s ] [ -t ] [-v ] [-U ] [ --AbBFnNqQuVz] +-w ] [-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. diff --git a/etc/grml/fai/config/hooks/updatebase.GRMLBASE b/etc/grml/fai/config/hooks/updatebase.GRMLBASE index 063cae4..93f4428 100755 --- a/etc/grml/fai/config/hooks/updatebase.GRMLBASE +++ b/etc/grml/fai/config/hooks/updatebase.GRMLBASE @@ -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 diff --git a/grml-live b/grml-live index 6d02701..23a89d7 100755 --- a/grml-live +++ b/grml-live @@ -71,6 +71,8 @@ Usage: $PN [options, see as follows] -U arrange output to be owned by specified username -v specify version number of the release -V increase verbosity in the build process + -w 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 -- 2.1.4