summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2016-05-11 15:24:36 +0000
committerintrigeri <intrigeri@boum.org>2016-05-11 15:43:18 +0000
commit9a32aeb10adcaedca480fe07ff5128ade02dd15a (patch)
tree05c118fa0f6788717bc25195eb0e70f25d19725b /bin
parentb87ea4d66f24ce6e2c00fc3307ba68260525a288 (diff)
Start drafting the tag-apt-snapshots script.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tag-apt-snapshots34
1 files changed, 34 insertions, 0 deletions
diff --git a/bin/tag-apt-snapshots b/bin/tag-apt-snapshots
index 8b13789..4307e33 100755
--- a/bin/tag-apt-snapshots
+++ b/bin/tag-apt-snapshots
@@ -1 +1,35 @@
+#!/bin/sh
+set -e
+set -u
+
+APT_HOST='apt.lizard'
+APT_USER='reprepro-tagged-snapshots'
+
+fail_with_usage() {
+ echo "$(basename $0) BUILD_MANIFEST TAG" >&2
+}
+
+[ $# -eq 2 ] || fail_with_usage
+
+BUILD_MANIFEST="$1"
+TAG="$2"
+
+[ -r "$BUILD_MANIFEST" ] || fail_with_usage
+[ -n "$TAG" ] || fail_with_usage
+
+REMOTE_BUILD_MANIFEST=$(ssh "${APT_USER}@${APT_HOST}" mktemp)
+REMOTE_DEST_DIR=$(ssh "${APT_USER}@${APT_HOST}" mktemp -d)
+
+scp "$BUILD_MANIFEST" "${APT_USER}@${APT_HOST}:${REMOTE_BUILD_MANIFEST}"
+
+# Build the tagged snapshots, i.e. pull packages listed in the build manifest
+# from the time-based snapshots into the tagged snapshots
+ssh "${APT_USER}@${APT_HOST}" \
+ tails-prepare-tagged-apt-snapshot-import \
+ "$REMOTE_BUILD_MANIFEST" \
+ "$REMOTE_DEST_DIR"
+ssh "${APT_USER}@${APT_HOST}" reprepro --basedir "$REMOTE_DEST_DIR" update
+
+# Publish the tagged snapshots
+ssh "${APT_USER}@${APT_HOST}" mv "$REMOTE_DEST_DIR" "repositories/$TAG"