/
install.sh
executable file
·89 lines (75 loc) · 2.39 KB
/
install.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
SYSTEMKEY="3d430f9af713781b92af4a97fc2e6664be7ce8e0"
# Set mode for script [ development, production ]
environment="production"
if [ $environment == "development" ]; then
set -vxe
fi
( set -o posix ; set ) >logs/variables.log
# Load the files required for this script
if [ -f ./bin/errors.sh ]; then source ./bin/errors.sh; else echo "./bin/errors.sh file is missing"; exit 141; fi
if [ -f ./bin/variables.sh ]; then source ./bin/variables.sh; else echo "./bin/variables.sh ${error["141"]}"; exit 141; fi
if [ -f ./bin/config.sh ]; then source ./bin/config.sh; else echo "./bin/config.sh ${error["141"]}"; exit 141; fi
if [ -f ./bin/functions.sh ]; then source ./bin/functions.sh; else echo "./bin/functions.sh ${error["141"]}"; exit 141; fi
if [ -f ./bin/menu.sh ]; then source ./bin/menu.sh; else echo "./bin/menu.sh ${error["141"]}"; exit 141; fi
if [ -f ./bin/dialog.sh ]; then source ./bin/dialog.sh; else echo "./bin/dialog.sh ${error["141"]}"; exit 141; fi
variables
varreset
tty -s
status=$?
if [ $status -ne 0 ]; then
log "${0} must run from terminal"
echo "${0} must be run from terminal"
echo error["110"]
exti 110
else
if [ "${BASH_VERSINFO}" -lt 4 ]; then
log "${error["140"]}"
exit 140
fi
fi
function main() {
log "Script started #############################################################"
log "Start installation script"
# Test for ncurses dialog application
echo -e $LIGHTRED"=== "$LIGHT_GREEN `date +'%I:%M:%S'` $LIGHT_RED" === "$WHITE"Starting Application and checking dependancies "$LIGHTRED"==="$COLOR_NONE
if haveprog "dialog"; then
log "Dialog is already installed"
if [ ! -f "./.dialogrc" ]; then
evallog "dialog --create-rc ./.dialogrc"
fi
else
evallog "${PKGINSTALL} dialog" & pid=$!
progress
if haveprog "dialog"; then
log "Dialog installed successfully"
else
log "${error["185"]}"
log "Script ended ###############################################################"
fi
fi
# Test for net-tools whois application
if haveprog "whois"; then
log "Whois is already installed"
else
evallog "${PKGINSTALL} whois" & pid=$!
progress
fi
if haveprog "lsb_release"; then
log "lsb_release is already installed"
else
evallog "${PKGINSTALL} redhat-lsb-core" & pid=$!
progress
fi
chkmemory
chkinet
chkversion
loadcfg
if [ "${PKGMGR}" == "apt" ]; then
evallog "DEBIAN_FRONTEND=noninteractive"
fi
chkmemory
menusystem
mainmenu
}
main