Refactor my refactoring :)
This commit is contained in:
parent
3284a5f2f5
commit
75213a93ea
1 changed files with 7 additions and 7 deletions
|
|
@ -6,17 +6,13 @@
|
||||||
# Functions
|
# Functions
|
||||||
|
|
||||||
function isRoot () {
|
function isRoot () {
|
||||||
if [[ "$EUID" -eq 0 ]]; then
|
if [ "$EUID" -ne 0 ]; then
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function tunAvailable () {
|
function tunAvailable () {
|
||||||
if [[ -e /dev/net/tun ]]; then
|
if [ ! -e /dev/net/tun ]; then
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -78,6 +74,10 @@ function initialCheck () {
|
||||||
checkOS
|
checkOS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getNIC () {
|
||||||
|
return $(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)
|
||||||
|
}
|
||||||
|
|
||||||
function newclient () {
|
function newclient () {
|
||||||
echo ""
|
echo ""
|
||||||
echo "Do you want to protect the configuration file with a password?"
|
echo "Do you want to protect the configuration file with a password?"
|
||||||
|
|
@ -222,7 +222,7 @@ private-address: ::ffff:0:0/96' > /etc/unbound/openvpn.conf
|
||||||
initialCheck
|
initialCheck
|
||||||
|
|
||||||
# Get Internet network interface with default route
|
# Get Internet network interface with default route
|
||||||
NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)
|
NIC=$(getNIC)
|
||||||
|
|
||||||
if [[ -e /etc/openvpn/server.conf ]]; then
|
if [[ -e /etc/openvpn/server.conf ]]; then
|
||||||
while :
|
while :
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue