-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·102 lines (83 loc) · 3.26 KB
/
Copy pathinstall
File metadata and controls
executable file
·102 lines (83 loc) · 3.26 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
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
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env bash
#===================================================================================
# LABADMIN INSTALLATION
# FILE: install
#
# DESCRIPTION: Install and check labadmin dependencies for admin and host
#
# AUTHOR: Leonardo Marco (labadmin@leonardomarco.com)
# LICENSE: GNU General Public License v3.0
# VERSION: 2019.04
# CREATED: 16.02.2017
#===================================================================================
#===============================================================================
# LOAD LIBS
#===============================================================================
readonly labadmin_path="$(dirname $(readlink -f "${0}"))" # LABADMIN script root directory path
readonly lib_path="${labadmin_path}/lib/" # LABADMIN LIB PATH
source "${lib_path}/labadmin_lib-admin" # LABADMIN ADMIN VARIABLES AND FUNCTIONS
source "${lib_path}/labadmin_lib" # LABADMIN GLOBAL VARIABLES AND FUNCTIONS
source "${lib_path}/labadmin_lib-script" # LABADMIN SCRIPT MODULE
source "${lib_path}/labadmin_lib-install" # LABADMIN INSTALL MODULE
#=== FUNCTION ==================================================================
# NAME: help
# DESCRIPTION: Show help and exit
# PARAMETERS:
# $1 exit code
#===============================================================================
function help() {
echo -e "Install and check labadmin dependencies for admin and host
ADMIN INSTALL
${S_B}$(basename $0)${S_R} admin Install admin controller
HOSTS INSTALL
${S_B}$(basename $0)${S_R} host Install and config hosts
CHECK DEPENDENCIES
${S_B}$(basename $0)${S_R} admin -d ask|autoinstall|noinstall No install, only check admin dependencies
${S_B}$(basename $0)${S_R} host -d ask|autoinstall|noinstall No install, only check host dependencies
"
exit $1
}
#### CHECK PARAMETERS
[ $# -eq 0 ] && help
install_type="$1"
[[ "$install_type" != @(admin|host) ]] && labadmin_error "Incorrect install type parameter. Select admin or host installation" 1
shift
while getopts ":d:h" o
do
case $o in
d) # -d:dependencies
dparam=1
daction="$OPTARG"
[[ "$daction" != @(ask|autoinstall|noinstall) ]] && labadmin_error "Incorrect check dependence action ${daction}\nSupported actions: ask, autoinstall and noinstall" 1
;;
h)
help
;;
*)
labadmin_error "Error parameter" 1
;;
esac
done
#### ACTION: INSTALL/CHECK
## DEPENDENCIES HOST
if [ "$install_type" = admin ] && [ "$dparam" ]; then
load_scripts "$scripts_path"
check_dependencies "$daction" "scripts_admindeps"
echo
## DEPENDENCIES ADMIN
elif [ "$install_type" = host ] && [ "$dparam" ]; then
load_scripts "$scripts_path"
check_dependencies "$daction" "scripts_hostdeps"
echo
## INSTALL ADMIN
elif [ "$install_type" = admin ]; then
load_scripts "$scripts_path"
install_admin "$lab_id"
## INSTALL HOST
elif [ "$install_type" = host ]; then
load_scripts "$scripts_path"
install_host "$nhost" "$lab_id"
## OTHER CASE
else
help 1
fi