-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
68 lines (39 loc) · 1.37 KB
/
setup.sh
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Every step, log it in case of crash.
# Initial text and DISCLAIMER
echo "$(<./bin/initialText)"
read thrash
# Check if running as root or sudo
if [ "$EUID" -ne 0 ]
then echo "Please run with sudo or as root!"
exit
fi
# Check if openVPN is installed
/usr/bin/dpkg -s openvpn &> .temp # Kinda dirty
prontDpkg=$(wc -l < .temp)
if [ "$expr $prontDpkg" -gt 4 ]; then # Output of dpkg -s openvpn should be > 4 if is installed
# Is installed
echo "OpenVPN is already installed, checking if updates are avaliable."
else
# Is not installed
echo "OpenVPN is not installed, press ENTER to INSTALL"
read thrash
apt install openvpn -y
fi
rm .temp
# Check if setup is executed with (parameter1) VPNprofile
# If not ask for path of VPNprofile
# If not pront how to set it up in /config/profile.opvpn
# Configure CRONTAB, ask for refreshrate
printf "Every how many minutes you want to check the VPN status? (Recommended 2): "
read refreshRateInMinutes # TODO: Check that input is correct, also fix, nothing working
echo $refreshRateInMinutes
if [ $refreshRateInMinutes -gt 59 ]; then
echo "ojo"
else
new_crontab="$refreshRateInMinutes" * * * * /ruta/del/comando""
fi
echo $new_crontab
#nueva_tarea="* * * * * /ruta/del/comando"
#echo "$(crontab -l)"$'\n'"$nueva_tarea" | crontab -
# Installation Completed, run opvpnAlwaysUp.sh