Compare commits

..

1 Commits

Author SHA1 Message Date
MickLesk
112f3cc4eb romm: make the library paths follow ROMM_BASE_PATH
Upstream derives everything from one setting:

  ROMM_BASE_PATH = _get_env("ROMM_BASE_PATH", "/romm")
  LIBRARY_BASE_PATH = f"{ROMM_BASE_PATH}/library"

There is no separate library setting; config.yml's roms_folder is only
a folder name inside the library. So ROMM_BASE_PATH in /opt/romm/.env
is the single lever, and everything that names a path has to follow it.

Two places did not. The watcher unit had /var/lib/romm/library written
into ExecStart, so a moved library was still watched at the default and
rescans never fired. It now uses ${ROMM_BASE_PATH}/library, which
systemd expands from the EnvironmentFile the unit already loads.

The Angie alias was derived from the env file, but only while the
install or an update ran. Editing ROMM_BASE_PATH afterwards left the
internal /library/ location pointing at the old path, and since the
backend serves content through X-Accel-Redirect, every download and
every play returned 404 while scanning and metadata kept working.
Re-sync it from an ExecStartPre on angie, so a restart is enough.

Update installs both for existing containers and rewrites the watcher
unit in place.

Reported in #17263. The suggested fix there was to template the alias,
which the scripts already did; the gap was that nothing re-applied it.
2026-09-15 10:19:50 +02:00
3 changed files with 37 additions and 5 deletions

View File

@@ -191,11 +191,30 @@ EOF
sed -i -e "s|alias .*/library/;|alias ${ROMM_BASE}/library/;|" \
-e "s|alias .*/cache/;|alias ${ROMM_BASE}/cache/;|" /etc/angie/http.d/romm.conf
fi
cat <<'SYNCEOF' >/usr/local/bin/romm-sync-angie-paths
#!/usr/bin/env bash
base="$(grep -m1 '^ROMM_BASE_PATH=' /opt/romm/.env 2>/dev/null | cut -d= -f2)"
base="${base:-/var/lib/romm}"
[[ -f /etc/angie/http.d/romm.conf ]] || exit 0
sed -i -e "s|alias .*/library/;|alias ${base}/library/;|" \
-e "s|alias .*/cache/;|alias ${base}/cache/;|" /etc/angie/http.d/romm.conf
SYNCEOF
chmod +x /usr/local/bin/romm-sync-angie-paths
mkdir -p /etc/systemd/system/angie.service.d
cat <<'DROPEOF' >/etc/systemd/system/angie.service.d/romm-paths.conf
[Service]
ExecStartPre=/usr/local/bin/romm-sync-angie-paths
DROPEOF
systemctl daemon-reload
systemctl reload angie
elif [[ -f /etc/nginx/sites-available/romm ]]; then
sed -i "s|alias .*/library/;|alias ${ROMM_BASE}/library/;|" /etc/nginx/sites-available/romm
nginx_enable_site romm
fi
if [[ -f /etc/systemd/system/romm-watcher.service ]]; then
sed -i "s|\(watcher\.py' \).*|\1\${ROMM_BASE_PATH}/library|" /etc/systemd/system/romm-watcher.service
systemctl daemon-reload
fi
msg_ok "Updated ROMM"
msg_info "Starting Services"

View File

@@ -327,8 +327,22 @@ server {
}
EOF
sed -i -e "s|alias /var/lib/romm/library/;|alias ${ROMM_BASE}/library/;|" \
-e "s|alias /var/lib/romm/cache/;|alias ${ROMM_BASE}/cache/;|" /etc/angie/http.d/romm.conf
cat <<'SYNCEOF' >/usr/local/bin/romm-sync-angie-paths
#!/usr/bin/env bash
base="$(grep -m1 '^ROMM_BASE_PATH=' /opt/romm/.env 2>/dev/null | cut -d= -f2)"
base="${base:-/var/lib/romm}"
[[ -f /etc/angie/http.d/romm.conf ]] || exit 0
sed -i -e "s|alias .*/library/;|alias ${base}/library/;|" \
-e "s|alias .*/cache/;|alias ${base}/cache/;|" /etc/angie/http.d/romm.conf
SYNCEOF
chmod +x /usr/local/bin/romm-sync-angie-paths
mkdir -p /etc/systemd/system/angie.service.d
cat <<'EOF' >/etc/systemd/system/angie.service.d/romm-paths.conf
[Service]
ExecStartPre=/usr/local/bin/romm-sync-angie-paths
EOF
systemctl daemon-reload
/usr/local/bin/romm-sync-angie-paths
rm -f /etc/angie/http.d/default.conf
systemctl restart angie
systemctl enable -q --now angie
@@ -405,7 +419,7 @@ Type=simple
WorkingDirectory=/opt/romm/backend
EnvironmentFile=/opt/romm/.env
Environment="PYTHONPATH=/opt/romm/backend"
ExecStart=/opt/romm/.venv/bin/watchfiles --target-type command '/opt/romm/.venv/bin/python watcher.py' /var/lib/romm/library
ExecStart=/opt/romm/.venv/bin/watchfiles --target-type command '/opt/romm/.venv/bin/python watcher.py' \${ROMM_BASE_PATH}/library
Restart=on-failure
RestartSec=5

View File

@@ -578,8 +578,7 @@ qm create "$VMID" -machine q35 -bios ovmf -agent enabled=1 -tablet 0 -localtime
-cores "$CORE_COUNT" -memory "$RAM_SIZE" -balloon 0 -name "$HN" -tags community-script \
-net0 "virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU" -onboot 1 -ostype l26 \
-efidisk0 $STORAGE:1,efitype=4m,pre-enrolled-keys=0 -sata0 $STORAGE:$DISK_SIZE,ssd=1 \
-scsihw virtio-scsi-single -cdrom local:iso/$ISO_NAME -vga virtio \
-boot order='sata0;ide2' >/dev/null
-scsihw virtio-scsi-single -cdrom local:iso/$ISO_NAME -vga virtio >/dev/null
msg_ok "Created VM shell"
if [ "$IMPORT_DISKS" == "yes" ]; then