blob: beccf2dc9f7338d68f9742c955075f7d82144edf (
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
|
post_upgrade() {
if (( $(vercmp "0.5.18" "$2") > 0 )); then
# needed because started before hooks
systemd-tmpfiles --create
if [[ -f /opt/headphones/config.ini && ! -f /var/lib/headphones/config.ini ]]; then
cp -a {/opt,/var/lib}/headphones/config.ini
echo "Copied config.ini from /opt/headphones/ -> /var/lib/headphones/"
fi
if [[ -f /opt/headphones/headphones.db && ! -f /var/lib/headphones/headphones.db ]]; then
cp -a {/opt,/var/lib}/headphones/headphones.db
echo "Copied headphones.db from /opt/headphones/ -> /var/lib/headphones/"
fi
if [[ -d /opt/headphones/logs && ! -d /var/lib/headphones/logs ]]; then
cp -a {/opt,/var/lib}/headphones/logs
echo "Copied logs from /opt/headphones/ -> /var/lib/headphones/"
fi
if [[ -d /opt/headphones/cache && ! -d /var/lib/headphones/cache ]]; then
cp -a {/opt,/var/lib}/headphones/cache
echo "Copied cache from /opt/headphones/ -> /var/lib/headphones/"
fi
fi
if [[ "$( getent passwd headphones | cut -d: -f6 )" != "/var/lib/headphones" ]]; then
usermod -d /var/lib/headphones headphones
if [[ $? -ne 0 ]]; then
echo "Could not change headphones users home directory."
echo "Run: sudo systemctl stop headphones ; sudo usermod -d /var/lib/headphones headphones ; sudo systemctl start headphones"
fi
fi
if [[ -d /opt/lazylibrarian ]]; then
echo "Remove /opt/lazylibrarian if everything is working correctly from /var/lib/lazylibrarian now."
fi
}
|