/
install_nettemp
executable file
·86 lines (70 loc) · 2.08 KB
/
install_nettemp
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#! /bin/bash
R='\033[0m'
RED='\033[00;31m'
REDB='\033[01;41;35m'
GREEN='\033[00;32m'
YELLOW='\033[00;33m'
dir=/var/www/nettemp
if [[ ! $(pwd) = "$dir" ]]; then
whiptail --title "Nettemp installer" --msgbox "Nettemp installer must be in /var/www/nettemp dir. Hit OK to exit." 8 78
exit 1
fi
if [[ $UID -ne 0 ]]; then
whiptail --title "Nettemp installer" --msgbox "You must be root. Hit OK to exit." 8 78
exit 1
fi
function fexit {
$1
exitstatus=$?
if [ $exitstatus = 1 ]; then
whiptail --clear --title "Nettemp installer" --msgbox "Error $1" 8 78
echo -e "[ ${red}error${R} ] Error in $2"
exit 1
else
echo -e "[ ${GREEN}ok${R} ] $2"
fi
}
function end {
whiptail --title "Nettemp installer" --msgbox "Nettemp successfully installed. Your user and password is \"admin\"." 8 78
whiptail --title "Nettemp installer" --msgbox "admin admin - remember!" 8 78
exitstatus=$?
if [ $exitstatus = 0 ]; then
if int=$(ifconfig eth0 2>/dev/null|awk '/inet addr:/ {print $2}'|sed 's/addr://'); then
echo -e "[ ${GREEN}ok${R} ] Go to http://$int"
else
int=$(ifconfig wlan0 2>/dev/null|awk '/inet addr:/ {print $2}'|sed 's/addr://')
echo -e "[ ${GREEN}ok${R} ] Go to http://$int"
fi
echo -e "Bye..."
exit 1
fi
}
function run {
source $dir/install/run.sh
} #>> install_log.txt 2>&1
function start {
whiptail --backtitle "Nettemp.pl" --title "Nettemp installer" --yesno "Do You want install nettemp?" 8 78
exitstatus=$?
if [ $exitstatus = 1 ]; then
echo "bye.."
exit 1s
fi
whiptail --backtitle "Nettemp.pl" --title "Nettemp installer" --yesno "Do You want generate OpenVPN certificate? (Long installation)" 8 78
exitstatus2=$?
if [ $exitstatus2 = 0 ]; then
OVCA=yes
fi
whiptail --backtitle "Nettemp.pl" --title "Nettemp installer" --yesno "Do You want start APC UPS?" 8 78
exitstatus2=$?
if [ $exitstatus2 = 0 ]; then
APCUPS=yes
fi
whiptail --backtitle "Nettemp.pl" --title "Nettemp installer" --yesno "Do You want send anonymous stats to stats.nettemp.pl" 8 78
exitstatus3=$?
if [ $exitstatus3 = 0 ]; then
SENDSTATS=yes
fi
}
start
fexit run Installation
end