blob: 23ef9da6c550a268a7180f66236cb177a13bbc99 (
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
|
# variables filled in by PKGBUILD
_usercheck() {
if ! getent group "${_mirthgroup}" &> /dev/null; then
groupadd -r "${_mirthgroup}"
echo "mirth: Group ${_mirthgroup} added"
fi
if ! getent passwd "${_mirthuser}" &> /dev/null; then
useradd -r -g "${_mirthgroup}" -G 'http' -d "${_mirthhome}" -s '/usr/bin/bash' -c 'mirth document server' "${_mirthuser}"
echo "mirth: User ${_mirthuser} added"
fi
}
post_upgrade() {
set -u
chown "${_mirthuser}:${_mirthgroup}" "${_mirthhome}"
chown -R "${_mirthuser}:${_mirthgroup}" "${_mirthhome}/conf"
set +u
}
post_install() {
set -u
_usercheck
post_upgrade
set +u
}
pre_remove() {
set -u
systemctl stop 'mirthconnect.service'
set +u
}
post_remove() {
set -u
if getent passwd "${_mirthuser}" &> /dev/null; then
userdel "${_mirthuser}"
echo "mirth: User ${_mirthgroup} removed"
fi
if getent group "${_mirthgroup}" &> /dev/null; then
groupdel "${_mirthgroup}"
echo "mirth: Group ${_mirthgroup} removed"
fi
if [ -d "${_mirthhome}" ]; then
echo "Uninstall all settings: sudo rm -rf '${_mirthhome}'"
fi
set +u
}
|