From 5330454f2b48a7a75f0d670f95afe609a19c67d0 Mon Sep 17 00:00:00 2001 From: shelleycat485 <63857845+shelleycat485@users.noreply.github.com> Date: Sun, 3 May 2020 17:55:48 +0100 Subject: [PATCH] added generic pivpn for 2 protocols --- scripts/pivpn | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 scripts/pivpn diff --git a/scripts/pivpn b/scripts/pivpn new file mode 100755 index 0000000..216b2cb --- /dev/null +++ b/scripts/pivpn @@ -0,0 +1,36 @@ +#!/bin/bash + +# Must be root to use this tool +if [ $EUID -ne 0 ];then + if dpkg-query -s sudo &> /dev/null; then + export SUDO="sudo" + else + echo "::: Please install sudo or run this as root." + exit 1 + fi +fi + +scriptdir="/opt/pivpn" +vpn="wireguard" + +showHelp(){ + echo "::: To pass off to the pivpn command for each protocol" + echo ":::" + echo "::: Usage: pivpn wg [option]" + echo "::: Usage: pivpn opv [option]" + echo ":::" + echo "::: -h, help Show this help dialog" + exit 0 +} + +if [ $# = 0 ]; then + showHelp +fi + +# Handle redirecting to specific functions based on arguments +case "$1" in + wg ) "${scriptDir}/wireguard/pivpn" "${@:2}";; + opv ) "${scriptDir}/openvpn/pivpn" "${@:2}";; +"-h" | "help" ) showHelp;; +* ) showHelp;; +esac