aboutsummaryrefslogtreecommitdiffstats
path: root/util/sign-and-upload.bash
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-10-13 20:00:26 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-10-14 13:03:10 +0200
commite3f0f43bb81119eafeb04b66cb7deacd5c1db743 (patch)
tree3141511288cc86bcf6b16eed3a28ba1590513555 /util/sign-and-upload.bash
downloadandroid-wireguard-module-builder-e3f0f43bb81119eafeb04b66cb7deacd5c1db743.tar.xz
android-wireguard-module-builder-e3f0f43bb81119eafeb04b66cb7deacd5c1db743.zip
Initial commit
Diffstat (limited to 'util/sign-and-upload.bash')
-rwxr-xr-xutil/sign-and-upload.bash19
1 files changed, 19 insertions, 0 deletions
diff --git a/util/sign-and-upload.bash b/util/sign-and-upload.bash
new file mode 100755
index 0000000..6d80694
--- /dev/null
+++ b/util/sign-and-upload.bash
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -ex
+
+BASE="$(readlink -f "$(dirname "$(readlink -f "$0")")")"
+source "$BASE/server.conf"
+SSH_OPTS=( -q -o ControlMaster=auto -o ControlPath=../.ssh-deployment.sock )
+
+cd "$BASE/../out"
+sha256sum *.ko > modules.txt
+signify -S -e -s "$SIGNING_KEY" -m modules.txt
+rm modules.txt
+
+ssh "${SSH_OPTS[@]}" -Nf "$WEB_SERVER"
+ssh -t "${SSH_OPTS[@]}" $WEB_SERVER "sudo -u nginx -v"
+rsync -aizm --delete --rsh="ssh ${SSH_OPTS[*]}" --rsync-path="sudo -n -u nginx rsync" ./ "$WEB_SERVER:$SERVER_PATH"
+ssh -t "${SSH_OPTS[@]}" "$WEB_SERVER" "sudo chown -R nginx:nginx '$SERVER_PATH'"
+ssh -t "${SSH_OPTS[@]}" "$WEB_SERVER" "sudo find '$SERVER_PATH' -type f -exec chmod 640 {} \;; sudo find '$SERVER_PATH' -type d -exec chmod 750 {} \;;"
+ssh -O exit "${SSH_OPTS[@]}" "$WEB_SERVER"
+