From ba24e9f786f03dad53758656d3dd7a1963efb1b9 Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Thu, 23 Jul 2020 04:12:31 -0700 Subject: [PATCH] automate snapshot date bump --- Makefile | 4 ++++ scripts/update-packages | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 68a24c7..10d2a26 100644 --- a/Makefile +++ b/Makefile @@ -119,11 +119,15 @@ update-packages: --user $(userid):$(groupid) \ --volume $(PWD)/config:/home/build/config \ --volume $(PWD)/scripts:/home/build/scripts \ + --env GIT_EPOCH="$(GIT_EPOCH)" \ $(IMAGE) tail -f /dev/null $(docker) exec -it --user=root "$(NAME)" update-packages $(docker) cp \ "$(NAME):/etc/apt/packages.list" \ "$(PWD)/config/container/packages.list" + $(docker) cp \ + "$(NAME):/etc/apt/sources.list" \ + "$(PWD)/config/container/sources.list" $(docker) rm -f "$(NAME)" ## Make Helpers diff --git a/scripts/update-packages b/scripts/update-packages index d7b5046..b146b7a 100755 --- a/scripts/update-packages +++ b/scripts/update-packages @@ -1,8 +1,15 @@ #!/bin/bash +[ -f /.dockerenv ] || { echo "please run in supplied container"; exit 1; } set -e apt update -y - apt upgrade -y dpkg -l | awk '{ if ($1 == "ii") print $2 "=" $3 }' > /etc/apt/packages.list + +snapshot_date=$(date -d @${GIT_EPOCH} +"%Y%m%dT000000Z") +cat <<-EOF > /etc/apt/sources.list +deb http://snapshot.debian.org/archive/debian/${snapshot_date} buster main +deb http://snapshot.debian.org/archive/debian-security/${snapshot_date} buster/updates main +deb http://snapshot.debian.org/archive/debian/${snapshot_date} buster-updates main +EOF