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