aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-06-26 00:59:25 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-06-26 01:00:26 +0200
commitfc2661f08a3ef08edec7704339577cc5c8c962e7 (patch)
treef34e5db3b2dc797531ec0da7fba701d294e09960
parentpatch-kernel: do not do freaky things to index (diff)
downloadandroid_kernel_wireguard-fc2661f08a3ef08edec7704339577cc5c8c962e7.tar.xz
android_kernel_wireguard-fc2661f08a3ef08edec7704339577cc5c8c962e7.zip
patch-kernel: only allow one execution at a time, with others failing open
-rw-r--r--fetch.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/fetch.sh b/fetch.sh
index dcc25de..4b00f43 100644
--- a/fetch.sh
+++ b/fetch.sh
@@ -2,6 +2,9 @@
set -e
USER_AGENT="WireGuard-AndroidROMBuild/0.1 ($(uname -a))"
+exec 9>.wireguard-fetch-lock
+flock -n 9 || exit 0
+
[[ $(( $(date +%s) - $(stat -c %Y "net/wireguard/.check" 2>/dev/null || echo 0) )) -gt 86400 ]] || exit 0
[[ $(curl -A "$USER_AGENT" -LSs https://git.zx2c4.com/WireGuard/refs/) =~ snapshot/WireGuard-([0-9.]+)\.tar\.xz ]]