-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·49 lines (43 loc) · 1.11 KB
/
install.sh
File metadata and controls
executable file
·49 lines (43 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
blue=`tput setaf 4`
reset=`tput sgr0`
for arg in "$@"; do
case $arg in
-p=*|--protocol=*)
PROTOCOL="${arg#*=}"
shift
;;
-u=*|--user=*)
USER="${arg#*=}"
shift
;;
-d=*|--domain=*)
DOMAIN="${arg#*=}"
shift
;;
-g=*|--group=*)
GROUP="${arg#*=}"
shift
;;
*)
# unknown option
;;
esac
done
echo "Please enter your password for your VPN connection."
read -s PASSWORD
cp ./config/myvpn.config /tmp/myvpn.config
sed -i "s/PASSWORD/$PASSWORD/g" /tmp/myvpn.config
sed -i "s/USER/$USER/g" /tmp/myvpn.config
sed -i "s/PROTOCOL/$PROTOCOL/g" /tmp/myvpn.config
sed -i "s/DOMAIN/$DOMAIN/g" /tmp/myvpn.config
sed -i "s/GROUP/$GROUP/g" /tmp/myvpn.config
sudo mkdir -p /etc/myvpn
sudo cp /tmp/myvpn.config /etc/myvpn/
sudo cp ./bin/myvpn.sh /usr/bin/myvpn
sudo chmod +x /usr/bin/myvpn
echo "${green}myvpn is installed successfully."
echo "${yellow}Usage: myvpn start|stop|status [-u|--user USER -p|--protocol PROTOCOL -d|--domain DOMAIN -g|--group GROUP] [--default]"