aboutsummaryrefslogtreecommitdiff
path: root/ods/ods.sh
blob: a71e02e2e95fd3dfe493553f3b12526641f37902 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env bash
set -euo pipefail

WORKDIR="/tmp/${EVENTLINE_JOB_NAME}"

cleanup() {
	rm -rf "${WORKDIR}"
}

trap cleanup EXIT

cd "${WORKDIR}"
git-crypt unlock "${EVENTLINE_DIR}/identities/gpg/private_key"

podman run --rm -ti -v "${WORKDIR}:/mnt" \
       --entrypoint "/bin/sh" \
       localhost/ods:latest \
       /bin/cp /usr/local/bin/ods /mnt/

SSHKEY="${EVENTLINE_DIR}/identities/ssh/private_key"
SSHOPTS="-i ${SSHKEY} -o StrictHostKeyChecking=accept-new"

rsync -e "ssh ${SSHOPTS}" "${WORKDIR}/ods" root@ods.adyxax.org:/srv/ods/
ssh root@ods.adyxax.org "systemctl restart ods"

trap - EXIT