diff options
Diffstat (limited to 'vpn')
-rwxr-xr-x | vpn | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -28,6 +28,9 @@ #!/usr/bin/bash +SCRIPT_DIR=$(dirname $(realpath $0)) +CONFIG_FILE=$SCRIPT_DIR/config + # Configurations CONF_DIR=YOUR_CONFIG_DIR CONF_FILE=YOUR_CONFIG_FILE @@ -70,6 +73,33 @@ set_routes() echo "$devtun ready." } +add_config() +{ + local config_file= + local config_name= + + while [ -z "$config_file" ]; do + echo -n "Set OpenVPN config file: " + read config_file + done + + while [ -z "$config_name" ]; do + echo -n "Set a name for the config file: " + read config_name + done + config_file=$(eval realpath "$config_file") + + echo "CONF_${config_name^^}=$config_file" > "$CONFIG_FILE" +} + +check_config() +{ + [ -f "$CONFIG_FILE" ] && return + add_config +} + +check_config + ISROOT=`id -u` if [ $ISROOT != 0 ]; then |