diff options
author | 2025-05-20 15:34:03 +0200 | |
---|---|---|
committer | 2025-05-20 15:34:03 +0200 | |
commit | 6ca439e45ddb80361346540f818d57fa5e293d6b (patch) | |
tree | d4845b939d7412cf7d4009d1c23ec2c3204a3292 | |
parent | a4024f70a7ccfb31146d7cd5ef6c3ac9e8e60822 (diff) | |
download | vpn-6ca439e45ddb80361346540f818d57fa5e293d6b.tar.gz vpn-6ca439e45ddb80361346540f818d57fa5e293d6b.zip |
-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 |