mirror of
https://github.com/Sonarr/Sonarr
synced 2025-03-11 14:47:44 +00:00
Also deal with migrations where the user installed using a different user.
This commit is contained in:
parent
54160850b2
commit
8f4067adbb
1 changed files with 17 additions and 5 deletions
|
@ -21,13 +21,25 @@ if ! getent passwd "$USER" >/dev/null; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $1 = "configure" ]; then
|
if [ $1 = "configure" ]; then
|
||||||
# Migrate old Sonarr v3 alpha data dir
|
# Migrate old Sonarr v3 alpha data dir from /var/opt/sonarr or user home
|
||||||
if [ -d "/var/opt/sonarr" ] && [ "$CONFDIR" != "/var/opt/sonarr" ] && [ ! -d "$CONFDIR" ]; then
|
if [ -d "/var/opt/sonarr" ] && [ "$CONFDIR" != "/var/opt/sonarr" ] && [ ! -d "$CONFDIR" ]; then
|
||||||
if [ ! -f "/var/opt/sonarr/sonarr.db" ] && [ -f "/var/opt/sonarr/.config/Sonarr/sonarr.db" ]; then
|
varoptRoot="/var/opt/sonarr"
|
||||||
mv "/var/opt/sonarr/.config/Sonarr" "$CONFDIR"
|
varoptAppData="$varoptRoot/.config/Sonarr"
|
||||||
rm -rf "/var/opt/sonarr"
|
sonarrUserHome=`getent passwd $USER | cut -d ':' -f 6`
|
||||||
|
sonarrAppData="$sonarrUserHome/.config/Sonarr"
|
||||||
|
if [ ! -f "$varoptRoot/sonarr.db" ]; then
|
||||||
|
# Handle /var/opt/sonarr/sonarr.db
|
||||||
|
mv "$varoptRoot" "$CONFDIR"
|
||||||
|
elif [ -f "$varoptAppData/sonarr.db" ]; then
|
||||||
|
# Handle /var/opt/sonarr/.config/Sonarr/sonarr.db
|
||||||
|
mv "$varoptAppData" "$CONFDIR"
|
||||||
|
rm -rf "$varoptRoot"
|
||||||
|
elif [ -f "$sonarrAppData/sonarr.db" ]; then
|
||||||
|
# Handle ~/.config/Sonarr/sonarr.db
|
||||||
|
mv "$sonarrAppData" "$CONFDIR"
|
||||||
|
rm -rf "$sonarrAppData"
|
||||||
else
|
else
|
||||||
mv "/var/opt/sonarr" "$CONFDIR"
|
mv "$varoptRoot" "$CONFDIR"
|
||||||
fi
|
fi
|
||||||
chown -R $USER:$GROUP "$CONFDIR"
|
chown -R $USER:$GROUP "$CONFDIR"
|
||||||
chmod -R 775 "$CONFDIR"
|
chmod -R 775 "$CONFDIR"
|
||||||
|
|
Loading…
Add table
Reference in a new issue