Print warning about empty public interface
Warning, if cannot detect public interface, and give user a choice to continue or abord.
This commit is contained in:
parent
6bb87ae716
commit
4609793ca4
1 changed files with 13 additions and 0 deletions
|
|
@ -607,6 +607,19 @@ function installOpenVPN () {
|
||||||
# Get the "public" interface from the default route
|
# Get the "public" interface from the default route
|
||||||
NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)
|
NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)
|
||||||
|
|
||||||
|
# $NIC can not be empty for script rm-openvpn-rules.sh
|
||||||
|
if [[ -z "$NIC" ]]; then
|
||||||
|
echo
|
||||||
|
echo "Can not detect public interface."
|
||||||
|
echo "This needs for setup MASQUERADE."
|
||||||
|
until [[ $CONTINUE =~ (y|n) ]]; do
|
||||||
|
read -rp "Continue? [y/n]: " -e CONTINUE
|
||||||
|
done
|
||||||
|
if [[ "$CONTINUE" = "n" ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$OS" =~ (debian|ubuntu) ]]; then
|
if [[ "$OS" =~ (debian|ubuntu) ]]; then
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get -y install ca-certificates gnupg
|
apt-get -y install ca-certificates gnupg
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue