7 BASE_URL
=http
://time-based.snapshots.deb.tails.boum.org
/
8 CONFIG
=config
/APT_snapshots.d
10 APT_SNAPSHOTS_SERIALS
=
11 FREEZE_EXCEPTIONS
=debian-security
15 wget
-q "$BASE_URL/$origin/project/trace/$origin" -O - \
16 |
awk -F': ' '/^Archive serial: / {print $2}'
20 find "$CONFIG" -mindepth 1 -maxdepth 1 -type d
-printf '%f\n'
25 ORIGINS
="$(list_origins)"
29 if [ "${1:-}" = --print-serials-only ]; then
33 if [ "${1:-}" = --freeze-debian-security ]; then
40 APT_SNAPSHOTS_SERIALS
="${1}"
50 cat|get-latest|freeze|thaw
)
52 ORIGINS
="$(list_origins)"
62 for origin
in $ORIGINS; do
63 [ -z "${SERIAL_ONLY}" ] && echo -n "$origin: "
64 cat "$CONFIG/$origin/serial"
68 "$(dirname "$0")"/apt-snapshots-serials-cat-json
"$CONFIG"
71 for origin
in $ORIGINS; do
72 [ -z "${SERIAL_ONLY}" ] && echo -n "$origin: "
73 get_latest_serial
"$origin"
77 for origin
in $ORIGINS; do
78 serial_file
="$CONFIG/$origin/serial"
79 git
=$
(cat "$serial_file")
80 # shellcheck disable=SC2254
86 new
=$
(get_latest_serial
"$origin")
88 printf "Origin %s:\n old: %s\n new: %s\n" \
89 "$origin" "$git" "$new"
90 echo "$new" > "$serial_file"
92 printf "\nAll files (%s/*/serial) have been updated with new serials\n" "$CONFIG" >&2
95 for origin
in $ORIGINS; do
96 serial_file
="$CONFIG/$origin/serial"
97 git
=$
(cat "$serial_file")
98 printf "Origin %s:\n old: %s\n new: latest\n" \
100 echo 'latest' > "$serial_file"
104 rm -rf tmp
/APT_snapshots.d
106 cp -r config
/APT_snapshots.d tmp
/
107 if [ "${APT_SNAPSHOTS_SERIALS}" ]; then
108 "$(dirname "$0")"/apt-snapshots-serials-load-json \
109 "$APT_SNAPSHOTS_SERIALS" \
110 > tmp
/cached_APT_snapshots_serials
112 $0 get-latest
> tmp
/cached_APT_snapshots_serials
114 for origin_dir
in tmp
/APT_snapshots.d
/*; do
115 origin
=$
(basename "$origin_dir")
116 if grep -qs '^latest$' "$origin_dir"/serial
; then
117 awk -F': ' "/^$origin: / {print \$2}" \
118 tmp
/cached_APT_snapshots_serials \
119 > "$origin_dir"/serial
124 printf "unknown action (%s), use either 'cat', 'cat-json', 'get-latest', 'prepare-build', 'freeze' or 'thaw'\n" "$action" >&2