blob: 56afa3d19b871d104ab96fa5498bcbc53421f47e (
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 /usr/lib/headphones/config.ini && ! -f /var/lib/headphones/config.ini ]]; then
cp -a {/usr/lib,/var/lib}/headphones/config.ini
echo "Copied config.ini from /usr/lib/headphones/ -> /var/lib/headphones/"
fi
if [[ -f /usr/lib/headphones/headphones.db && ! -f /var/lib/headphones/headphones.db ]]; then
cp -a {/usr/lib,/var/lib}/headphones/headphones.db
echo "Copied headphones.db from /usr/lib/headphones/ -> /var/lib/headphones/"
fi
if [[ -d /usr/lib/headphones/logs && ! -d /var/lib/headphones/logs ]]; then
cp -a {/usr/lib,/var/lib}/headphones/logs
echo "Copied logs from /usr/lib/headphones/ -> /var/lib/headphones/"
fi
if [[ -d /usr/lib/headphones/cache && ! -d /var/lib/headphones/cache ]]; then
cp -a {/usr/lib,/var/lib}/headphones/cache
echo "Copied cache from /usr/lib/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 /usr/lib/lazylibrarian ]]; then
echo "Remove /usr/lib/lazylibrarian if everything is working correctly from /var/lib/lazylibrarian now."
fi
}
|