6 TIME_BASED_SNAPSHOTS_HOST
='apt.lizard'
7 TIME_BASED_SNAPSHOTS_USER
='reprepro-time-based-snapshots'
8 TIME_BASED_SNAPSHOTS_USER_AT_HOST
="${TIME_BASED_SNAPSHOTS_USER}@${TIME_BASED_SNAPSHOTS_HOST}"
11 echo "$(basename $0) BUILD_MANIFEST TAG" >&2
14 [ $# -eq 2 ] || fail_with_usage
19 [ -r "$BUILD_MANIFEST" ] || fail_with_usage
20 [ -n "$TAG" ] || fail_with_usage
22 echo "I: Preparing a workspace on ${TIME_BASED_SNAPSHOTS_HOST}"
23 ssh "$TIME_BASED_SNAPSHOTS_USER_AT_HOST" install -d '$HOME'/tmp
24 REMOTE_BUILD_MANIFEST
=$
(ssh "$TIME_BASED_SNAPSHOTS_USER_AT_HOST" \
25 mktemp
--tmpdir='$HOME'/tmp
)
26 REMOTE_DEST_DIR
=$
(ssh "$TIME_BASED_SNAPSHOTS_USER_AT_HOST" \
27 mktemp
-d --tmpdir='$HOME'/tmp
)
29 echo "I: Sending build manifest to ${TIME_BASED_SNAPSHOTS_HOST}"
30 scp
"$BUILD_MANIFEST" \
31 "${TIME_BASED_SNAPSHOTS_USER_AT_HOST}:${REMOTE_BUILD_MANIFEST}"
33 echo "I: Preparing reprepro configuration"
34 ssh "$TIME_BASED_SNAPSHOTS_USER_AT_HOST" \
35 tails-prepare-tagged-apt-snapshot-import \
36 "$REMOTE_BUILD_MANIFEST" \
39 echo "I: Pulling packages from the time-based snapshots into the tagged ones"
40 for archive
in $
(ssh "$TIME_BASED_SNAPSHOTS_USER_AT_HOST" \
41 ls "$REMOTE_DEST_DIR") ; do
43 ssh "$TIME_BASED_SNAPSHOTS_USER_AT_HOST" \
44 reprepro
--basedir "${REMOTE_DEST_DIR}/${archive}" update
47 echo "I: Publishing the tagged APT snapshot"
48 ssh "${TIME_BASED_SNAPSHOTS_USER}@${TIME_BASED_SNAPSHOTS_HOST}" \
49 sudo
-n /usr
/local
/sbin
/tails-publish-tagged-apt-snapshot \
50 "$REMOTE_DEST_DIR" "$TAG"
53 ssh "${TIME_BASED_SNAPSHOTS_USER}@${TIME_BASED_SNAPSHOTS_HOST}" \
54 rm "$REMOTE_BUILD_MANIFEST"