-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathset_notifications.sh
53 lines (37 loc) · 1.13 KB
/
set_notifications.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
#!/bin/bash
set -e
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 [[ ${APP_NAME} == "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 [[ ${APP_NAME} == "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
success "Notifications ${action}d"