Merge branch '20674-cope-with-python3-flask-update' into 'devel'
[tails.git] / bin / add-release-to-iso-history
blob26143d7dda9933af634b5f40dbb5ee48c77f437b
1 #!/bin/bash
3 set -eu
4 set -o pipefail
6 NAME=$(basename "${0}")
7 LONGOPTS="version:,isos:,release-branch:,matching-jenkins-images-build-id:"
8 OPTS=$(getopt -o "" --longoptions $LONGOPTS -n "${NAME}" -- "$@")
9 eval set -- "$OPTS"
10 while [ $# -gt 0 ]; do
11 case $1 in
12 --version)
13 shift
14 VERSION="$1"
16 --isos)
17 shift
18 ISOS="$1"
20 --release-branch)
21 shift
22 RELEASE_BRANCH="$1"
24 --matching-jenkins-images-build-id)
25 shift
26 MATCHING_JENKINS_IMAGES_BUILD_ID="$1"
28 esac
29 shift
30 done
32 # shellcheck disable=SC2029
33 ssh misc.lizard mkdir "tails-amd64-${VERSION:?}"
35 scp "${ISOS:?}/tails-amd64-${VERSION:?}/tails-amd64-${VERSION:?}."{apt-sources,build-manifest,buildlog,packages,iso.sig,img.sig} \
36 "misc.lizard:tails-amd64-${VERSION:?}"
38 ssh misc.lizard gpg --import < "wiki/src/tails-signing.key"
40 # shellcheck disable=SC2087
41 ssh misc.lizard << EOF
42 cd tails-amd64-${VERSION:?} && \
43 wget --quiet \
44 "https://nightly.tails.boum.org/build_Tails_ISO_${RELEASE_BRANCH:?}/builds/${MATCHING_JENKINS_IMAGES_BUILD_ID:?}/archive/build-artifacts/tails-amd64-${VERSION:?}.iso" \
45 "https://nightly.tails.boum.org/build_Tails_ISO_${RELEASE_BRANCH:?}/builds/${MATCHING_JENKINS_IMAGES_BUILD_ID:?}/archive/build-artifacts/tails-amd64-${VERSION:?}.img" && \
46 gpg --verify tails-amd64-${VERSION:?}.iso{.sig,} && \
47 gpg --verify tails-amd64-${VERSION:?}.img{.sig,}
48 EOF
50 # shellcheck disable=SC2087
51 ssh misc.lizard << EOF
52 ( [ -d isos ] || git clone gitolite@puppet-git.lizard:isos.git ) && \
53 cd isos && \
54 git annex init && \
55 git annex sync --no-content && \
56 git annex import ../tails-amd64-${VERSION:?} && \
57 rmdir ../tails-amd64-${VERSION:?} && \
58 git commit -m "Add Tails ${VERSION:?}" && \
59 git annex sync --no-content && \
60 git annex copy tails-amd64-${VERSION:?} --to origin && \
61 git annex drop tails-amd64-${VERSION:?} && \
62 git annex sync --no-content
63 EOF