-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgo_install_app.sh
executable file
·102 lines (73 loc) · 1.92 KB
/
go_install_app.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
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/bash
set -e
BASE=${HOME}/atlassian-tools
. ${BASE}/conf/config.sh
. ${BASE}/lib/utils.sh
BIN="${BASE}"/bin
FULLPATH=$(/usr/bin/readlink -e "$0")
SOURCES="${BASE}"/install-upgrade/"${APP_NAME}"
INSTALLER=''
[[ $VERBOSE -eq $YES ]] && set -x
###
# FUNCTIONS
###
install_core() {
[[ -d "${APP_INSTALL_DIR}" ]] && die "APP_INSTALL_DIR '${APP_INSTALL_DIR}' exists ... skipping app install"
[[ -z "$INSTALLER" ]] && INSTALLER=$( get_installer )
[[ -f "$INSTALLER" ]] || die "Installer file not found; '$INSTALLER' "
/usr/bin/chmod +x "${INSTALLER}"
"${INSTALLER}" -q -varfile "${SOURCES}"/response.varfile
}
install_config() {
[[ $VERBOSE -eq $YES ]] && set -x
local _template="${SOURCES}"/server.xml.tmpl
/usr/bin/sed -e "s/___PROXYNAME___/${HOSTNAME_NEW}/" "${_template}" \
> "${APP_INSTALL_DIR}"/conf/server.xml
}
install_admin_pwd() {
[[ $VERBOSE -eq $YES ]] && set -x
local _pwd_file=$(/usr/bin/find "${SOURCES}" -type f -name '*.pwd' -print)
[[ -f "${_pwd_file}" ]] && {
/usr/bin/mv "${_pwd_file}" /root/.
}
}
print_usage() {
local _prg=$(/usr/bin/basename "${FULLPATH}")
cat <<ENDHERE
${_prg}
Install all or part of the Atlassian app
SYNOPSYS
${_prg} [OPTIONS] [installer_file.bin]
OPTIONS
-h --help Print this help
-c --configonly Install just the config file (server.xml)
ENDHERE
}
###
# MAIN
###
# Getopts
action="install"
ENDWHILE=0
while [[ $# -gt 0 ]] && [[ $ENDWHILE -eq 0 ]] ; do
case $1 in
-h|--help) print_usage; exit 0;;
-c|--configonly) action="configonly";;
--) ENDWHILE=1;;
-*) echo "Invalid option '$1'"; exit 1;;
*) ENDWHILE=1; break;;
esac
shift
done
INSTALLER="$1"
if [[ "${action}" == 'install' ]] ; then
# Install
install_core
install_config
"${BIN}"/set_notifications.sh disable
"${BIN}"/fix_java_heap_size.sh
"${BIN}"/mk_systemd.sh
install_admin_pwd
elif [[ "${action}" == 'configonly' ]] ; then
install_config
fi