mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
added generic pivpn for 2 protocols
This commit is contained in:
parent
3ed9ec5724
commit
5330454f2b
1 changed files with 36 additions and 0 deletions
36
scripts/pivpn
Executable file
36
scripts/pivpn
Executable file
|
@ -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 <command> [option]"
|
||||
echo "::: Usage: pivpn opv <command> [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
|
Loading…
Reference in a new issue