12345678910111213141516171819202122232425 |
- #!/usr/bin/env bash
- cd $(realpath $(dirname $0))
- source "inc/common.sh"
- cat "$DATADIR_OVPNS/ovpns.list"
- read -p 'Enter the connection number to connect: ' connumber
- ovpn_file="$DATADIR_OVPNS/$connumber.ovpn"
- if [ -f "$ovpn_file" ]; then
- openvpn_bin='openvpn'
- su_bin='sudo'
- openvpn_args=(
- ${su_bin}
- ${openvpn_bin}
- #--daemon 'gatekeeper' # TODO: need to implement Ctrl+C inturrupt loop first
- --config "$ovpn_file"
- --script-security 2 --up inc/vpn_up.sh --down inc/vpn_down.sh
- )
- # Run the openvpn command
- "${openvpn_args[@]}"
- fi
|