A library on the internal disk gets a database

"Run repair without external drive" kept the library on the internal disk,
but the API's unmounted-media guard refuses to create or use a database
beneath /media/wrolpi when it is not a mount.  After onboarding without a
drive the API restarted forever with no database, and downloads were
blocked as "media not mounted".

The Controller now records the choice as drives.library_on_internal_disk in
controller.yaml -- the only source of it.  The database guard and the
media_mounted check both read that marker, so require_media_mounted keeps
its meaning and needs no change.  Onboarding a drive later clears the
marker, so it is never copied onto the drive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-10-14 16:09:44 -06:00
parent 559bfebc56
commit 3acb7439a4
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
8 changed files with 119 additions and 10 deletions

View file

@ -176,13 +176,15 @@ def onboard_without_drive() -> dict:
Set up WROLPi with the library on the internal disk, then start repair.
controller.yaml marks the primary drive as set up; without it the wizard
would be shown again after repair.
would be shown again after repair. Its drives.library_on_internal_disk
tells the API that /media/wrolpi is deliberately not a mount.
Returns:
dict with success, mounts, and repair_started
"""
config_dir = get_media_directory() / "config"
config_dir.mkdir(parents=True, exist_ok=True)
update_config("drives.library_on_internal_disk", True)
save_config()
repair_result = start_script("repair")
@ -282,8 +284,11 @@ def commit_onboarding(
if not fstab_result.get("success"):
logger.warning("Failed to add primary fstab entry: %s", fstab_result.get("error"))
# Step 5: Reload config from drive and ensure controller.yaml exists
# Step 5: Reload config from drive and ensure controller.yaml exists.
# The library now lives on this drive, even if this process earlier
# onboarded without one.
reload_config_from_drive()
update_config("drives.library_on_internal_disk", False)
try:
save_config()
except RuntimeError: