blob: 84f39473eaa1521a4f47b5de5ec253c30aef57b2 (
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
|
post_upgrade() {
if [[ -d /opt/sabnzbd ]]; then
# Test for the *old* config file and *lack* of new config file, move if needed.
if [[ -f /opt/sabnzbd/sabnzbd.ini && ! -f /var/lib/sabnzbd/sabnzbd.ini ]]; then
cp -a /opt/sabnzbd/sabnzbd.ini /var/lib/sabnzbd/
mv /opt/sabnzbd/sabnzbd.ini /opt/sabnzbd/sabnzbd.ini.saved
echo "Copied sabnzbd.ini from /opt/sabnzbd to /var/lib/sabnzbd and renamed /opt/sabnzbd/sabnzbd.ini to /opt/sabnzbd/sabnzbd.ini.saved."
fi
# Test for old admin folder and *lack* of new admin folder, move if needed.
if [[ -d /opt/sabnzbd/admin && ! -d /var/lib/sabnzbd/admin ]]; then
cp -a /opt/sabnzbd/admin /var/lib/sabnzbd/
mv /opt/sabnzbd/admin /opt/sabnzbd/admin.saved
echo "Copied admin folder from /opt/sabnzbd to /var/lib/sabnzbd/ and renamed /opt/sabnzbd/admin to /opt/sabnzbd/admin.saved."
fi
# Test for old logs folder and *lack* of new logs folder, move if needed.
if [[ -d /opt/sabnzbd/logs && ! -d /var/lib/sabnzbd/logs ]]; then
cp -a /opt/sabnzbd/logs /var/lib/sabnzbd/
mv /opt/sabnzbd/logs /opt/sabnzbd/logs.saved
echo "Copied logs folder from /opt/sabnzbd to /var/lib/sabnzbd/ and renamed /opt/sabnzbd/logs to /opt/sabnzbd/logs.saved."
fi
# Suggest removing /opt/sabnzbd.
echo "Remove /opt/sabnzbd if everything is working correctly from /var/lib/sabnzbd now."
fi
# Check and change the sabnzbd users home directory
SABNZBD_HOME="$( getent passwd sabnzbd | awk -F: '{ print $6 }' )"
if [[ "${SABNZBD_HOME}" != "/var/lib/sabnzbd" ]]; then
if usermod --home /var/lib/sabnzbd sabnzbd; then
echo "User sabnzbd home directory changed to /var/lib/sabnzbd."
else
echo "Error changing sabnzbd home directory, stop sabnzbd and run 'usermod --home /var/lib/sabnzbd sabnzbd' yourself."
fi
fi
}
|