mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-07-28 16:52:55 +02:00
fix(bazarr): store data in /var/lib/bazarr instead of inside /opt/bazarr (#16098)
* fix(bazarr): store data in /var/lib/bazarr instead of inside /opt/bazarr The installer creates /var/lib/bazarr and update_script() uses it as the "is Bazarr installed" guard, but nothing pointed Bazarr at it. Bazarr defaults its data directory to <install dir>/data, resolved from its own source file rather than WorkingDirectory, so a stock container kept config/ db/ backup/ cache/ log/ restore/ in /opt/bazarr/data - the directory fetch_and_deploy_gh_release redeploys over - while /var/lib/bazarr stayed empty. Pass -c /var/lib/bazarr in the unit, matching the -data= flag the other *arr scripts use. bazarr.py re-execs its child with sys.argv[1:], so the flag survives the restart Bazarr performs while loading its config. update_script() gains a one-time migration for existing installs. It runs outside the release check so containers already on the latest version are migrated too, is skipped when the unit already names a data directory, refuses (before stopping the service) when both locations hold data, and copies before removing so a failed migration leaves the original database in place. Fixes #16097 * fix(bazarr): drop explanatory comments per review
This commit is contained in:
@@ -28,6 +28,31 @@ function update_script() {
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! grep -qE -- "bazarr\.py.*[[:space:]](-c|--config)([[:space:]]|=)" /etc/systemd/system/bazarr.service 2>/dev/null; then
|
||||
if [[ -d /opt/bazarr/data && ! -L /opt/bazarr/data && -n "$(ls -A /var/lib/bazarr/ 2>/dev/null)" ]]; then
|
||||
msg_error "/opt/bazarr/data and /var/lib/bazarr both contain data - refusing to merge them. Keep the copy you want in /var/lib/bazarr, remove /opt/bazarr/data, then run the update again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
msg_info "Moving Bazarr data to /var/lib/bazarr"
|
||||
systemctl stop bazarr
|
||||
if [[ -L /opt/bazarr/data ]]; then
|
||||
rm -f /opt/bazarr/data
|
||||
elif [[ -d /opt/bazarr/data ]]; then
|
||||
if ! cp -a /opt/bazarr/data/. /var/lib/bazarr/; then
|
||||
systemctl start bazarr
|
||||
msg_error "Could not copy /opt/bazarr/data to /var/lib/bazarr - nothing was removed."
|
||||
exit 1
|
||||
fi
|
||||
rm -rf /opt/bazarr/data
|
||||
fi
|
||||
sed -i -E "s|^(ExecStart=.*bazarr\.py.*)$|\1 -c /var/lib/bazarr|" /etc/systemd/system/bazarr.service
|
||||
systemctl daemon-reload
|
||||
systemctl start bazarr
|
||||
msg_ok "Moved Bazarr data to /var/lib/bazarr"
|
||||
fi
|
||||
|
||||
if check_for_gh_release "bazarr" "morpheus65535/bazarr"; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop bazarr
|
||||
|
||||
@@ -36,7 +36,7 @@ UMask=0002
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
Type=simple
|
||||
ExecStart=/opt/bazarr/venv/bin/python3 /opt/bazarr/bazarr.py
|
||||
ExecStart=/opt/bazarr/venv/bin/python3 /opt/bazarr/bazarr.py -c /var/lib/bazarr
|
||||
KillSignal=SIGINT
|
||||
TimeoutStopSec=20
|
||||
SyslogIdentifier=bazarr
|
||||
|
||||
Reference in New Issue
Block a user