From 8ab71601ffda62ec8fc575a6f76b824f83739762 Mon Sep 17 00:00:00 2001 From: Orazio Date: Sat, 16 Nov 2019 17:02:15 +0100 Subject: [PATCH] Automatically fetch latest WireGuard snapshot --- auto_install/install.sh | 10 ++++++---- scripts/uninstall.sh | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/auto_install/install.sh b/auto_install/install.sh index 5e5f80a..50bf3af 100755 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -37,9 +37,6 @@ easyrsaRel="https://github.com/OpenVPN/easy-rsa/releases/download/v${easyrsaVer} UNATTUPG_RELEASE="1.14" UNATTUPG_CONFIG="https://github.com/mvo5/unattended-upgrades/archive/${UNATTUPG_RELEASE}.tar.gz" -WG_SNAPSHOT="0.0.20191012" -WG_SOURCE="https://git.zx2c4.com/WireGuard/snapshot/WireGuard-${WG_SNAPSHOT}.tar.xz" - # Find the rows and columns. Will default to 80x24 if it can not be detected. screen_size=$(stty size 2>/dev/null || echo 24 80) rows=$(echo $screen_size | awk '{print $1}') @@ -738,9 +735,12 @@ Pin-Priority: 500" | $SUDO tee /etc/apt/preferences.d/limit-unstable > /dev/null elif [ "$(uname -m)" = "armv6l" ]; then echo "::: Installing WireGuard from source... " - PIVPN_DEPS=(checkinstall dkms libmnl-dev libelf-dev raspberrypi-kernel-headers build-essential pkg-config qrencode) + PIVPN_DEPS=(checkinstall dkms libmnl-dev libelf-dev raspberrypi-kernel-headers build-essential pkg-config qrencode jq) installDependentPackages PIVPN_DEPS[@] + WG_SNAPSHOT="$(curl -s https://build.wireguard.com/distros.json | jq -r '."upstream-kmodtools"."version"')" + WG_SOURCE="https://git.zx2c4.com/WireGuard/snapshot/WireGuard-${WG_SNAPSHOT}.tar.xz" + # Delete any leftover code $SUDO rm -rf /usr/src/wireguard-* @@ -804,6 +804,8 @@ Pin-Priority: 500" | $SUDO tee /etc/apt/preferences.d/limit-unstable > /dev/null exit 1 fi + echo "WG_SNAPSHOT=${WG_SNAPSHOT}" >> /tmp/setupVars.conf + elif [ "$(uname -m)" = "x86_64" ] || [ "$(uname -m)" = "i686" ]; then echo "::: Installing WireGuard from Debian package... " diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 646de20..56ffbe7 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -2,7 +2,6 @@ # PiVPN: Uninstall Script PKG_MANAGER="apt-get" -WG_SNAPSHOT="0.0.20191012" setupVars="/etc/pivpn/setupVars.conf" if [ ! -f "${setupVars}" ]; then