Skip to content

Commit

Permalink
mv installer into bin/
Browse files Browse the repository at this point in the history
  • Loading branch information
andylytical committed Mar 13, 2024
1 parent 3d16e23 commit ec94a61
Show file tree
Hide file tree
Showing 22 changed files with 428 additions and 149 deletions.
2 changes: 1 addition & 1 deletion bin/disable_mail.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BASE=/root/atlassian-tools
BASE=${HOME}/atlassian-tools

. ${BASE}/conf/config.sh
. ${BASE}/lib/utils.sh
Expand Down
18 changes: 2 additions & 16 deletions bin/disable_notifications.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
#!/bin/bash

BASE=/root/atlassian-tools
BASE=${HOME}/atlassian-tools

. ${BASE}/conf/config.sh
. ${BASE}/lib/utils.sh

[[ $VERBOSE -eq $YES ]] && set -x

SETENV="${APP_INSTALL_DIR}"/bin/setenv.sh
[[ -f "$SETENV" ]] || die "File not found, SETENV: '$SETENV'"


sed_opts=( '-i' )
[[ $DEBUG -eq $YES ]] && unset sed_opts

# # JIRA
# grep -q DISABLE_NOTIFICATIONS "$SETENV" \
# && sed "${sed_opts[@]}" -e 's/^[ #]*\(DISABLE_NOTIFICATIONS=\)/\1/' "$SETENV"

# CONFLUENCE & JIRA
sed "${sed_opts[@]}" -e '/atlassian.mail.senddisabled=true/ s/^[ #]*//' "$SETENV"
"${BASE}"/bin/set_notifications.sh disable
8 changes: 8 additions & 0 deletions bin/enable_notifications.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

BASE=${HOME}/atlassian-tools

. ${BASE}/conf/config.sh
. ${BASE}/lib/utils.sh

"${BASE}"/bin/set_notifications.sh enable
2 changes: 1 addition & 1 deletion bin/fix_app_config.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BASE=/root/atlassian-tools
BASE=${HOME}/atlassian-tools

. ${BASE}/conf/config.sh
. ${BASE}/lib/utils.sh
Expand Down
2 changes: 1 addition & 1 deletion bin/fix_cron.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BASE=/root/atlassian-tools
BASE=${BASE}/atlassian-tools

. ${BASE}/conf/config.sh
. ${BASE}/lib/utils.sh
Expand Down
2 changes: 1 addition & 1 deletion bin/fix_hostname.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BASE=/root/atlassian-tools
BASE=${HOME}/atlassian-tools

. ${BASE}/conf/config.sh
. ${BASE}/lib/utils.sh
Expand Down
2 changes: 1 addition & 1 deletion bin/fix_keytab.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BASE=/root/atlassian-tools
BASE=${HOME}/atlassian-tools

. ${BASE}/conf/config.sh
. ${BASE}/lib/utils.sh
Expand Down
2 changes: 1 addition & 1 deletion bin/fix_network.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BASE=/root/atlassian-tools
BASE=${HOME}/atlassian-tools

. ${BASE}/conf/config.sh
. ${BASE}/lib/utils.sh
Expand Down
2 changes: 1 addition & 1 deletion bin/fix_web_configs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BASE=/root/atlassian-tools
BASE=${HOME}/atlassian-tools

. ${BASE}/conf/config.sh
. ${BASE}/lib/utils.sh
Expand Down
2 changes: 1 addition & 1 deletion bin/go_fix_web.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BASE=/root/atlassian-tools
BASE=${HOME}/atlassian-tools
BIN="$BASE"/bin

. "$BASE"/conf/config.sh
Expand Down
105 changes: 105 additions & 0 deletions bin/go_install_app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/usr/bin/bash

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}"

[[ $VERBOSE -eq $YES ]] && set -x

set -x


install_core() {
[[ -d "${APP_INSTALL_DIR}" ]] && {
/usr/bin/echo "APP_INSTALL_DIR '${APP_INSTALL_DIR}' exists ... skipping app install" 1>&2
return -1
}

local _installer=$( /usr/bin/find "${SOURCES}"
-type f \
-name "${FILE_NAME_PATTERN}" \
-print \
| /usr/bin/sort -V \
| /usr/bin/tail -1)
/usr/bin/chmod +x "${_installer}"
"${_installer}" -q -varfile "${SOURCES}"/response.varfile
}


install_config() {
set -x
local _hn=$(/usr/bin/hostname -f)
local _template="${SOURCES}"/server.xml.tmpl
/usr/bin/sed -e "s/___PROXYNAME___/${_hn}/" "${_template}" \
> "${APP_INSTALL_DIR}"/conf/server.xml
}


install_admin_pwd() {
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

FILE_NAME_PATTERN="$1"
[[ -z "${FILE_NAME_PATTERN}" ]] && FILE_NAME_PATTERN='atlassian*.bin'

if [[ "${action}" == 'install' ]] ; then
# Install
install_core && {

/usr/bin/echo
/usr/bin/echo "INSTALL SUCCESS"
/usr/bin/echo

install_config

"${BIN}"/disable_notifications.sh

"${BIN}"/set_java_heap_size.sh

install_admin_pwd
}
elif [[ "${action}" == 'configonly' ]] ; then
install_config
fi
2 changes: 1 addition & 1 deletion bin/go_mk_test_server.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BASE=/root/atlassian-tools
BASE=${HOME}/atlassian-tools
BIN="$BASE"/bin

. "$BASE"/conf/config.sh
Expand Down
2 changes: 1 addition & 1 deletion bin/go_validate_test_server.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BASE=/root/atlassian-tools
BASE=${HOME}/atlassian-tools
BIN="$BASE"/bin

. ${BASE}/conf/config.sh
Expand Down
2 changes: 1 addition & 1 deletion bin/mk_certs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BASE=/root/atlassian-tools
BASE=${HOME}/atlassian-tools
BIN="$BASE"/bin

. ${BASE}/conf/config.sh
Expand Down
5 changes: 5 additions & 0 deletions bin/rcp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ SRC_HOME=''
TGT_HOME=''
SRC_PATH=''
TGT_PATH=''
SHOW_REMOTE_FILES=1 #YES
OFFER_TO_CLEAN_FILES=1 #YES


### FUNCTIONS
Expand Down Expand Up @@ -75,6 +77,8 @@ get_action() {
(attachments)
SRC_PATH="$SRC_HOME"/attachments
TGT_PATH="$TGT_HOME"/attachments
SHOW_REMOTE_FILES=0 #NO
OFFER_TO_CLEAN_FILES=0 #NO
;;
(*)
die 'Unknown action'
Expand All @@ -84,6 +88,7 @@ get_action() {


ls_remote() {
[[ $SHOW_REMOTE_FILES -eq 0 ]] && return 0
local _host="$1"
local _path="$2"
echo "Files on ${_host}:${_path} ..."
Expand Down
28 changes: 28 additions & 0 deletions bin/set_java_heap_size.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

BASE=${HOME}/atlassian-tools

. ${BASE}/conf/config.sh
. ${BASE}/lib/utils.sh

[[ $VERBOSE -eq $YES ]] && set -x

SETENV="${APP_INSTALL_DIR}"/bin/setenv.sh
[[ -f "$SETENV" ]] || die "File not found, SETENV: '$SETENV'"

sed_opts=( '-i' )
[[ $DEBUG -eq $YES ]] && unset sed_opts


if [[ ${APP_NAME} == "jira" ]] ; then
sed "${sed_opts[@]}" \
-e '/^JVM_MINIMUM_MEMORY=/ c JVM_MINIMUM_MEMORY="2048m"' \
-e '/^JVM_MAXIMUM_MEMORY=/ c JVM_MAXIMUM_MEMORY="4096m"' \
"${SETENV}"

elif [[ ${APP_NAME} == "confluence" ]] ; then
sed "${sed_opts[@]}" \
's/\(-Xm[sx]\)[0-9]\+m/\18192m/g' \
"${SETENV}"

fi
49 changes: 49 additions & 0 deletions bin/set_notifications.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

BASE=${HOME}/atlassian-tools

. ${BASE}/conf/config.sh
. ${BASE}/lib/utils.sh

[[ $VERBOSE -eq $YES ]] && set -x

SETENV="${APP_INSTALL_DIR}"/bin/setenv.sh
[[ -f "$SETENV" ]] || die "File not found, SETENV: '$SETENV'"


sed_opts=( '-i' )
[[ $DEBUG -eq $YES ]] && unset sed_opts

action=$1
case ${action} in
(enable|disable)
: pass
;;
(*)
die "missing or unknown action '$action'"
;;
esac

if [[ ${APPNAME} == "jira" ]] ; then

if [[ ${action} == "disable" ]] ; then
# disable - jira
sed "${sed_opts[@]}" -e 's/^[ #]*\(DISABLE_NOTIFICATIONS=\)/\1/' "$SETENV"

elif [[ ${action} == "enable" ]] ; then
# enable - jira
sed "${sed_opts[@]}" -e 's/^[ #]*\(DISABLE_NOTIFICATIONS=\)/#\1/' "$SETENV"
fi

elif [[ ${APPNAME} == "confluence" ]] ; then

if [[ ${action} == "disable" ]] ; then
# disable - confluence
sed "${sed_opts[@]}" -e '/atlassian.mail.senddisabled=true/ s/^[ #]*//' "$SETENV"

elif [[ ${action} == "enable" ]] ; then
# enable - confluence
sed "${sed_opts[@]}" -e '/atlassian.mail.senddisabled=true/ s/^[ #]*/#/' "$SETENV"
fi

fi
2 changes: 1 addition & 1 deletion bin/stop_services.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BASE=/root/atlassian-tools
BASE=${HOME}/atlassian-tools

. ${BASE}/conf/config.sh
. ${BASE}/lib/utils.sh
Expand Down
Loading

0 comments on commit ec94a61

Please sign in to comment.