blob: b54414a41c027e9cb88fc76926ae1dacbf6432c3 (
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
|
_homedir=/var/lib/libresonic
_playlistdir=/var/playlists
post_install() {
getent group libresonic &>/dev/null || groupadd --system libresonic > /dev/null
getent passwd libresonic &>/dev/null || useradd --system \
--home-dir /var/lib/libresonic \
--shell /usr/bin/nologin \
--gid libresonic \
--groups audio \
--comment "Libresonic user" \
libresonic > /dev/null
passwd --lock libresonic &> /dev/null
fix_permissions
echo "*************************************************"
echo "* Edit /etc/libresonic.conf to configure libresonic *"
echo "*************************************************"
systemctl daemon-reload
}
pre_remove() {
if [[ `systemctl is-active libresonic` == 'active' ]]; then
systemctl stop libresonic
fi
}
post_remove() {
getent passwd libresonic &>/dev/null && userdel libresonic &>/dev/null
getent group libresonic &>/dev/null && groupdel libresonic &>/dev/null
}
fix_permissions() {
chown -R libresonic:libresonic ${_homedir}
chown libresonic:libresonic ${_playlistdir}
}
pre_upgrade() {
rm -f /tmp/libresonic-was-active
if [[ `systemctl is-active libresonic` == 'active' ]]; then
touch /tmp/libresonic-was-active
echo "Stopping libresonic"
systemctl stop libresonic
fi
}
post_upgrade() {
post_install
if [ -e /tmp/libresonic-was-active ]; then
echo "Starting libresonic"
systemctl start libresonic
rm /tmp/libresonic-was-active
fi
}
|