blob: 92e00505f0edf5085923a0f4a51908128c0a2e32 (
plain)
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
|
_reload_http() {
set -u
if systemctl is-active 'httpd.service' >/dev/null; then
systemctl reload 'httpd.service' # graceful
fi
set +u
}
_start_systemd() {
systemctl daemon-reload
systemctl enable 'avantfax.phb.timer'
systemctl start 'avantfax.phb.timer'
systemctl enable 'avantfax.cron.timer'
systemctl start 'avantfax.cron.timer'
}
post_upgrade() {
set -u
_start_systemd
avantfaxsetup.sh 2 'build' 'post' # updates are applied here from backup copied below
set +u
}
pre_upgrade() {
set -u
avantfaxsetup.sh 1 'preun'
avantfaxsetup.sh 2 'pre' # copy backup info to apply update above
set +u
}
pre_install() {
:
}
post_install() {
set -u
_start_systemd
avantfaxsetup.sh 1 'build' 'pre' 'post'
local _opt_SOURCEONLY=1; . 'avantfaxsetup.sh'; unset _opt_SOURCEONLY
_httpinclude="Include conf/extra/httpd-${_opt_AVANTFAX_SERVERNAME}.conf"
_httpconf='/etc/httpd/conf/httpd.conf'
if ! grep "${_httpinclude}"'$' "${_httpconf}" &>/dev/null; then
if [ "${_opt_AUTO_START_HTTP}" -ne 0 ]; then
echo "${_httpinclude}" >> "${_httpconf}"
_reload_http
else
echo "# ${_httpinclude}" >> "${_httpconf}"
echo "Enable Include ... ${_opt_AVANTFAX_SERVERNAME} in httpd.conf"
fi
fi
set +u
}
pre_remove() {
set -u
systemctl stop 'avantfax.phb.timer'
systemctl disable 'avantfax.phb.timer'
systemctl stop 'avantfax.cron.timer'
systemctl disable 'avantfax.cron.timer'
local _opt_SOURCEONLY=1; . 'avantfaxsetup.sh'; unset _opt_SOURCEONLY
_httpinclude="Include conf/extra/httpd-${_opt_AVANTFAX_SERVERNAME}.conf"
_httpconf='/etc/httpd/conf/httpd.conf'
_conftemp='/tmp/avantfax.httpd.conf'
if grep "${_httpinclude}"'$' "${_httpconf}" &>/dev/null; then
rm -f "${_conftemp}"
cp -p "${_httpconf}" "${_conftemp}"
grep -v "${_httpinclude}"'$' "${_conftemp}" > "${_httpconf}"
rm -f "${_conftemp}"
_reload_http
fi
avantfaxsetup.sh 0 'preun'
cp -p '/usr/bin/avantfaxsetup.sh'{,.password} '/tmp'
set +u
}
post_remove() {
set -u
systemctl daemon-reload
/tmp/avantfaxsetup.sh 0 'postun'
local _opt_SOURCEONLY=1; . '/tmp/avantfaxsetup.sh'; unset _opt_SOURCEONLY
# This completely removes your config. Not everyone may want this.
rm -rf "/usr/share/webapps/${_opt_AVANTFAX_SERVERNAME}" '/root/avantfaxbackup'
rm -f '/tmp/avantfaxsetup.sh'{,.password} '/usr/bin/avantfaxsetup.sh.password'
set +u
}
|