aboutsummaryrefslogtreecommitdiffstats
path: root/fetch-wireguard.sh
diff options
context:
space:
mode:
Diffstat (limited to 'fetch-wireguard.sh')
-rwxr-xr-xfetch-wireguard.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/fetch-wireguard.sh b/fetch-wireguard.sh
new file mode 100755
index 0000000..73a2200
--- /dev/null
+++ b/fetch-wireguard.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+set -e
+
+[[ $(( $(date +%s) - $(stat -c %Y .last-wireguard-fetch 2>/dev/null || echo 0) )) -gt 21600 ]] || exit 0
+
+[[ $(curl -L https://git.zx2c4.com/WireGuard/refs/) =~ snapshot/(WireGuard-[0-9.]+\.tar\.xz) ]]
+rm -rf wireguard-src
+mkdir wireguard-src
+curl -L "https://git.zx2c4.com/WireGuard/snapshot/${BASH_REMATCH[1]}" | tar -C "wireguard-src" --strip-components=1 -xJf -
+touch .last-wireguard-fetch