Minor clean up
This commit is contained in:
parent
f58afbc84b
commit
cebf9f4361
10
vpnsetup.sh
10
vpnsetup.sh
@ -71,17 +71,15 @@ NET_IF0=${VPN_IFACE:-'eth0'}
|
|||||||
NET_IFS=${VPN_IFACE:-'eth+'}
|
NET_IFS=${VPN_IFACE:-'eth+'}
|
||||||
if_state=$(cat "/sys/class/net/$NET_IF0/operstate" 2>/dev/null)
|
if_state=$(cat "/sys/class/net/$NET_IF0/operstate" 2>/dev/null)
|
||||||
if [ -z "$if_state" ] || [ "$if_state" = "down" ] || [ "$NET_IF0" = "lo" ]; then
|
if [ -z "$if_state" ] || [ "$if_state" = "down" ] || [ "$NET_IF0" = "lo" ]; then
|
||||||
echo "Error: Network interface '$NET_IF0' is not available." >&2
|
printf "Error: Network interface '%s' is not available.\n" "$NET_IF0" >&2
|
||||||
|
printf '\n%s\n' "DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC!" >&2
|
||||||
|
printf '\n%s\n\n' "If running on a server, try this workaround:" >&2
|
||||||
cat 1>&2 <<'EOF'
|
cat 1>&2 <<'EOF'
|
||||||
|
|
||||||
DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC!
|
|
||||||
|
|
||||||
If running on a server, try this workaround:
|
|
||||||
|
|
||||||
VPN_IFACE="$(route | grep '^default' | grep -o '[^ ]*$')"
|
VPN_IFACE="$(route | grep '^default' | grep -o '[^ ]*$')"
|
||||||
EOF
|
EOF
|
||||||
cat 1>&2 <<EOF
|
cat 1>&2 <<EOF
|
||||||
sudo VPN_IFACE="\$VPN_IFACE" sh "$0"
|
sudo VPN_IFACE="\$VPN_IFACE" sh "$0"
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -64,17 +64,15 @@ NET_IF0=${VPN_IFACE:-'eth0'}
|
|||||||
NET_IFS=${VPN_IFACE:-'eth+'}
|
NET_IFS=${VPN_IFACE:-'eth+'}
|
||||||
if_state=$(cat "/sys/class/net/$NET_IF0/operstate" 2>/dev/null)
|
if_state=$(cat "/sys/class/net/$NET_IF0/operstate" 2>/dev/null)
|
||||||
if [ -z "$if_state" ] || [ "$if_state" = "down" ] || [ "$NET_IF0" = "lo" ]; then
|
if [ -z "$if_state" ] || [ "$if_state" = "down" ] || [ "$NET_IF0" = "lo" ]; then
|
||||||
echo "Error: Network interface '$NET_IF0' is not available." >&2
|
printf "Error: Network interface '%s' is not available.\n" "$NET_IF0" >&2
|
||||||
|
printf '\n%s\n' "DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC!" >&2
|
||||||
|
printf '\n%s\n\n' "If running on a server, try this workaround:" >&2
|
||||||
cat 1>&2 <<'EOF'
|
cat 1>&2 <<'EOF'
|
||||||
|
|
||||||
DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC!
|
|
||||||
|
|
||||||
If running on a server, try this workaround:
|
|
||||||
|
|
||||||
VPN_IFACE="$(route | grep '^default' | grep -o '[^ ]*$')"
|
VPN_IFACE="$(route | grep '^default' | grep -o '[^ ]*$')"
|
||||||
EOF
|
EOF
|
||||||
cat 1>&2 <<EOF
|
cat 1>&2 <<EOF
|
||||||
sudo VPN_IFACE="\$VPN_IFACE" sh "$0"
|
sudo VPN_IFACE="\$VPN_IFACE" sh "$0"
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user