Forked from damianhodgkiss/edgeos_install_wireguard.sh
Created
December 22, 2018 17:10
-
-
Save kpine/9517ee0a9ecdcdf86191be8e8a43b101 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
function install_wireguard () { | |
echo "Downloading Wireguard ($RELEASE)..." | |
FILENAME="wireguard-$BOARD-$RELEASE.deb" | |
DEB_URL="https://github.com/Lochnair/vyatta-wireguard/releases/download/$RELEASE/$FILENAME" | |
if (/usr/bin/curl -s -L -o /tmp/$FILENAME $DEB_URL); then | |
echo "Installing $FILENAME..." | |
dpkg -i /tmp/$FILENAME | |
rm -f /tmp/$FILENAME | |
else | |
echo "Error downloading Wireguard package" | |
exit 1 | |
fi | |
} | |
BOARD=`cat /etc/version | egrep -o '(e100|e1000|e200|e300|e50|ugw3|ugw4|ugwxg)'` | |
if [ "$BOARD" = "" ]; then | |
echo "Unsupported board" | |
exit 1 | |
fi | |
PKG=`dpkg-query --show --showformat='${version},${status}' wireguard` | |
INSTALLED_VERSION=`echo $PKG | cut -d, -f1` | |
INSTALLED_STATUS=`echo $PKG | cut -d, -f2 | egrep -o installed` | |
RELEASE=$(/usr/bin/curl -s https://api.github.com/repos/Lochnair/vyatta-wireguard/releases | /usr/bin/jq -r '.[0].tag_name') | |
if [ "$INSTALLED_STATUS" = "installed" ] && [ "$INSTALLED_VERSION" = "$RELEASE" ]; then | |
echo "Latest Wireguard already installed" | |
exit 0 | |
elif [ "$INSTALLED_STATUS" != "installed" ]; then | |
echo "Wireguard not installed yet" | |
install_wireguard | |
elif [ "$INSTALLED_VERSION" != "$RELEASE" ]; then | |
echo "Wireguard install differs from latest release, upgrading" | |
install_wireguard | |
fi |
Re-install after upgrading EdgeOS.
cd /config/scripts
sudo sh edgeos_install_wireguard.sh
sudo modprobe wireguard
configure
load
commit
exit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install:
cd /config/scripts curl -O https://gist.githubusercontent.com/kpine/9517ee0a9ecdcdf86191be8e8a43b101/raw/ec7ec0943a4bb86399e39bba4f2386fbf0aaa1ce/edgeos_install_wireguard.sh chmod 755 edgeos_install_wireguard.sh
Run: