Skip to content

Commit 3748a0d

Browse files
authored
Merge pull request #12 from AkihiroSuda/dev
Allow setting KEEP_CACHE=0
2 parents 1ddc967 + 9fb3fce commit 3748a0d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Examples:
3838
| `WRITE_SOURCE_DATE_EPOCH` | Write the `SOURCE_DATE_EPOCH` value to a file | `/dev/null` |
3939
| `SNAPSHOT_ARCHIVE_BASE` | Base URL of the snapshot | `http://snapshot-cloudflare.debian.org/archive/`, etc. (See below) |
4040
| `BACKPORTS` | Enable Debian backports | `0` |
41+
| `KEEP_CACHE` | Keep apt cache | `1` |
4142

4243
Distribution-specific default values:
4344

repro-sources-list.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ set -eux -o pipefail
3434

3535
. /etc/os-release
3636

37+
: "${KEEP_CACHE:=1}"
38+
3739
keep_apt_cache() {
3840
rm -f /etc/apt/apt.conf.d/docker-clean
3941
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache
@@ -59,7 +61,7 @@ case "${ID}" in
5961
echo "deb [check-valid-until=no] ${SNAPSHOT_ARCHIVE_BASE}debian-security/${snapshot} ${VERSION_CODENAME}-security main" >>/etc/apt/sources.list
6062
echo "deb [check-valid-until=no] ${SNAPSHOT_ARCHIVE_BASE}debian/${snapshot} ${VERSION_CODENAME}-updates main" >>/etc/apt/sources.list
6163
if [ "${BACKPORTS}" = 1 ]; then echo "deb [check-valid-until=no] ${SNAPSHOT_ARCHIVE_BASE}debian/${snapshot} ${VERSION_CODENAME}-backports main" >>/etc/apt/sources.list; fi
62-
keep_apt_cache
64+
if [ "${KEEP_CACHE}" = 1 ]; then keep_apt_cache; fi
6365
;;
6466
"ubuntu")
6567
: "${SNAPSHOT_ARCHIVE_BASE:=http://snapshot.ubuntu.com/}"
@@ -75,7 +77,7 @@ case "${ID}" in
7577
echo "deb [check-valid-until=no] ${SNAPSHOT_ARCHIVE_BASE}ubuntu/${snapshot} ${VERSION_CODENAME}-security main restricted" >>/etc/apt/sources.list
7678
echo "deb [check-valid-until=no] ${SNAPSHOT_ARCHIVE_BASE}ubuntu/${snapshot} ${VERSION_CODENAME}-security universe" >>/etc/apt/sources.list
7779
echo "deb [check-valid-until=no] ${SNAPSHOT_ARCHIVE_BASE}ubuntu/${snapshot} ${VERSION_CODENAME}-security multiverse" >>/etc/apt/sources.list
78-
keep_apt_cache
80+
if [ "${KEEP_CACHE}" = 1 ]; then keep_apt_cache; fi
7981
# http://snapshot.ubuntu.com is redirected to https, so we have to install ca-certificates
8082
export DEBIAN_FRONTEND=noninteractive
8183
apt-get -o Acquire::https::Verify-Peer=false update >&2

0 commit comments

Comments
 (0)