From 570a17053c7f52313e02196cf6dce10c6bb0c5cb Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Tue, 11 Nov 2014 17:19:55 -0600 Subject: [PATCH] Applying slightly modified patch from Rui Miguel P. Bernardo to provide support of --snapshot option for utilizing snapshot.debian.org. --- functions/debian-snapshot.sh | 138 +++++++++++++++++++++++ functions/defaults.sh | 24 ++++ scripts/build/bootstrap_archive-keys | 7 +- scripts/build/chroot_apt | 10 ++ scripts/build/config | 12 +- scripts/build/installer_debian-installer | 5 + 6 files changed, 194 insertions(+), 2 deletions(-) create mode 100755 functions/debian-snapshot.sh diff --git a/functions/debian-snapshot.sh b/functions/debian-snapshot.sh new file mode 100755 index 000000000..7bdf5e2f5 --- /dev/null +++ b/functions/debian-snapshot.sh @@ -0,0 +1,138 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +## This is free software, and you are welcome to redistribute it +## under certain conditions; see COPYING for details. + +Short_date () +{ + SHORT_DATE="${1}:-${LB_SNAPSHOT}}" + # returns the date as YYYYMMDD + echo "${SHORT_DATE}" | cut -c 1-8 +} + +Last_archive_entry () +{ + # returns the last date link + LAST_ENTRY="$(cat /tmp/index.html | grep "$(date +%Y%m)" | sed 's|.* chroot/etc/apt/apt.conf.d/00http-proxy fi + # Configuring snapshot.debian.org + if [ -n "${LB_SNAPSHOT}" ] + then + echo '// see bug #595801' > chroot/etc/apt/apt.conf.d/00debian-snapshot + echo 'Acquire::Check-Valid-Until "false";' >> chroot/etc/apt/apt.conf.d/00debian-snapshot + fi + # Configuring apt pipeline if [ -n "${LB_APT_PIPELINE}" ] then @@ -227,6 +234,9 @@ EOF # Deconfiguring aptitude http proxy rm -f chroot/etc/apt/apt.conf.d/00http-proxy + # Deconfiguring snapshot.debian.org + rm -f chroot/etc/apt/apt.conf.d/00debian-snapshot + # Deconfiguring aptitude pipeline rm -f chroot/etc/apt/apt.conf.d/00pipeline diff --git a/scripts/build/config b/scripts/build/config index e3b1e5170..ac8af909b 100755 --- a/scripts/build/config +++ b/scripts/build/config @@ -52,6 +52,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\ \t [--debian-installer-distribution daily|CODENAME]\n\ \t [--debian-installer-preseedfile FILE|URL]\n\ \t [--debian-installer-gui true|false]\n\ +\t [--snapshot yyyymmdd|yyyymmddThhmmssZ\n\ \t [--debug]\n\ \t [-d|--distribution CODENAME]\n\ \t [--parent-distribution CODENAME]\n\ @@ -147,7 +148,7 @@ Local_arguments () net-cow-server:,net-tarball:,firmware-binary:,firmware-chroot:,swap-file-path:,swap-file-size:, loadlin:,win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force, help,ignore-system-defaults,quiet,usage,verbose,version,bootstrap-qemu-static:,bootstrap-qemu-arch:, - bootstrap-qemu-exclude:" + bootstrap-qemu-exclude:,snapshot:" # Remove spaces added by indentation LONG_OPTIONS="$(echo ${LONG_OPTIONS} | tr -d ' ')" ARGUMENTS="$(getopt --longoptions ${LONG_OPTIONS} --name="${PROGRAM}" --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")" @@ -300,6 +301,11 @@ Local_arguments () shift 2 ;; + --snapshot) + LB_SNAPSHOT="${2}" + shift 2 + ;; + --initramfs) LB_INITRAMFS="${2}" shift 2 @@ -949,6 +955,10 @@ LB_DEBCONF_FRONTEND="${LB_DEBCONF_FRONTEND}" # (Default: ${LB_DEBCONF_PRIORITY}) LB_DEBCONF_PRIORITY="${LB_DEBCONF_PRIORITY}" +# \$LB_SNAPSHOT: set snapshot.debian.org date to use +# (Default: empty or not set to not use archive snapshot, or a valid date in snapshot.debian.org URL format) +LB_SNAPSHOT="${LB_SNAPSHOT}" + # \$LB_INITRAMFS: set initramfs hook # (Default: ${LB_INITRAMFS}) LB_INITRAMFS="${LB_INITRAMFS}" diff --git a/scripts/build/installer_debian-installer b/scripts/build/installer_debian-installer index 6415ffffd..63b90914e 100755 --- a/scripts/build/installer_debian-installer +++ b/scripts/build/installer_debian-installer @@ -256,6 +256,11 @@ case "${LB_DERIVATIVE}" in # Debian Installer daily builds URL="http://d-i.debian.org/daily-images/${LIVE_IMAGE_ARCHITECTURE}/daily/" + # use snapshot installer too + if [ -n "${LB_SNAPSHOT}" ] + then + URL="http://d-i.debian.org/daily-images/${LIVE_IMAGE_ARCHITECTURE}/$(Available_daily_installer)/" + fi else URL="${LB_MIRROR_DEBIAN_INSTALLER}/dists/${LB_DEBIAN_INSTALLER_DISTRIBUTION}/main/installer-${LIVE_IMAGE_ARCHITECTURE}/current/images/" fi