diff --git a/furtka/assets/Caddyfile b/assets/Caddyfile similarity index 100% rename from furtka/assets/Caddyfile rename to assets/Caddyfile diff --git a/furtka/assets/bin/furtka-status b/assets/bin/furtka-status similarity index 100% rename from furtka/assets/bin/furtka-status rename to assets/bin/furtka-status diff --git a/furtka/assets/bin/furtka-welcome b/assets/bin/furtka-welcome similarity index 100% rename from furtka/assets/bin/furtka-welcome rename to assets/bin/furtka-welcome diff --git a/furtka/assets/systemd/furtka-api.service b/assets/systemd/furtka-api.service similarity index 100% rename from furtka/assets/systemd/furtka-api.service rename to assets/systemd/furtka-api.service diff --git a/furtka/assets/systemd/furtka-reconcile.service b/assets/systemd/furtka-reconcile.service similarity index 100% rename from furtka/assets/systemd/furtka-reconcile.service rename to assets/systemd/furtka-reconcile.service diff --git a/furtka/assets/systemd/furtka-status.service b/assets/systemd/furtka-status.service similarity index 100% rename from furtka/assets/systemd/furtka-status.service rename to assets/systemd/furtka-status.service diff --git a/furtka/assets/systemd/furtka-status.timer b/assets/systemd/furtka-status.timer similarity index 100% rename from furtka/assets/systemd/furtka-status.timer rename to assets/systemd/furtka-status.timer diff --git a/furtka/assets/systemd/furtka-welcome.service b/assets/systemd/furtka-welcome.service similarity index 100% rename from furtka/assets/systemd/furtka-welcome.service rename to assets/systemd/furtka-welcome.service diff --git a/furtka/assets/www/index.html b/assets/www/index.html similarity index 100% rename from furtka/assets/www/index.html rename to assets/www/index.html diff --git a/furtka/assets/www/settings/index.html b/assets/www/settings/index.html similarity index 100% rename from furtka/assets/www/settings/index.html rename to assets/www/settings/index.html diff --git a/furtka/assets/www/status.json b/assets/www/status.json similarity index 100% rename from furtka/assets/www/status.json rename to assets/www/status.json diff --git a/furtka/assets/www/style.css b/assets/www/style.css similarity index 100% rename from furtka/assets/www/style.css rename to assets/www/style.css diff --git a/iso/build.sh b/iso/build.sh index 56923ca..1317a87 100755 --- a/iso/build.sh +++ b/iso/build.sh @@ -76,7 +76,7 @@ mkdir -p "$PROFILE_WORK/airootfs/opt/furtka" cp -a "$REPO_ROOT/webinstaller/." "$PROFILE_WORK/airootfs/opt/furtka/" # Ship the post-install asset tree (HTML, CSS, systemd units, scripts, …) # next to webinstaller/app.py so _resolve_assets_dir() finds it at runtime. -cp -a "$REPO_ROOT/furtka/assets" "$PROFILE_WORK/airootfs/opt/furtka/assets" +cp -a "$REPO_ROOT/assets" "$PROFILE_WORK/airootfs/opt/furtka/assets" rm -rf "$PROFILE_WORK/airootfs/opt/furtka/__pycache__" # Pack the resource manager (furtka/ Python package + bundled apps/) as a @@ -89,6 +89,9 @@ echo "==> Bundling resource manager payload" PAYLOAD_STAGE="$(mktemp -d)" cp -a "$REPO_ROOT/furtka" "$PAYLOAD_STAGE/" cp -a "$REPO_ROOT/apps" "$PAYLOAD_STAGE/" +# assets/ ships at the tarball root (not inside the Python package) because +# Caddy, systemd, and the updater all expect it at /opt/furtka/current/assets/. +cp -a "$REPO_ROOT/assets" "$PAYLOAD_STAGE/" find "$PAYLOAD_STAGE" -type d -name __pycache__ -exec rm -rf {} + # VERSION at tarball root: the installer reads it to choose the versions// # directory name and /opt/furtka/current/VERSION reports it at runtime. diff --git a/scripts/build-release-tarball.sh b/scripts/build-release-tarball.sh index e71b795..17b238a 100755 --- a/scripts/build-release-tarball.sh +++ b/scripts/build-release-tarball.sh @@ -23,6 +23,9 @@ trap 'rm -rf "$STAGE"' EXIT cp -a "$REPO_ROOT/furtka" "$STAGE/" cp -a "$REPO_ROOT/apps" "$STAGE/" +# assets/ ships at the tarball root — Caddy + systemd + updater resolve +# everything from /opt/furtka/current/assets/, never from inside the package. +cp -a "$REPO_ROOT/assets" "$STAGE/" find "$STAGE" -type d -name __pycache__ -exec rm -rf {} + echo "$VERSION" > "$STAGE/VERSION" diff --git a/tests/test_webinstaller_assets.py b/tests/test_webinstaller_assets.py index e24604b..42a1e4d 100644 --- a/tests/test_webinstaller_assets.py +++ b/tests/test_webinstaller_assets.py @@ -26,7 +26,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "webinstaller")) import app # noqa: E402 REPO_ROOT = Path(__file__).resolve().parent.parent -ASSETS = REPO_ROOT / "furtka" / "assets" +ASSETS = REPO_ROOT / "assets" # (install target path, asset path under furtka/assets/) — only the files we diff --git a/webinstaller/app.py b/webinstaller/app.py index 402bc08..f9e7007 100644 --- a/webinstaller/app.py +++ b/webinstaller/app.py @@ -148,7 +148,7 @@ def build_disk_config(boot_drive): # console shows a welcome banner pointing at the URL. # # Asset files (HTML, CSS, shell scripts, systemd units, Caddyfile) live in -# furtka/assets/ in the repo — at ISO build time they end up on the live ISO +# assets/ in the repo — at ISO build time they end up on the live ISO # as part of the webinstaller's source tree AND inside the resource-manager # payload tarball. The installer reads them from the live-ISO copy, base64- # encodes them, and hands them to archinstall so the chroot recreates each @@ -157,7 +157,7 @@ def build_disk_config(boot_drive): # --------------------------------------------------------------------------- # Tarball built by iso/build.sh containing the furtka/ Python package + the -# bundled apps/ tree (plus furtka/assets/). The webinstaller reads it from the +# bundled apps/ tree (plus assets/). The webinstaller reads it from the # live ISO at request-time and base64-encodes it into a custom_command for # archinstall. RESOURCE_MANAGER_PAYLOAD = Path("/opt/furtka-resource-manager.tar.gz") @@ -165,9 +165,9 @@ RESOURCE_MANAGER_PAYLOAD = Path("/opt/furtka-resource-manager.tar.gz") # Asset root. Two layouts we have to handle: # dev / tests — webinstaller/app.py sits at repo_root/webinstaller/ and -# assets live at repo_root/furtka/assets/. +# assets live at repo_root/assets/. # live ISO — iso/build.sh copies webinstaller/ to /opt/furtka/ AND -# copies furtka/assets/ to /opt/furtka/assets/ right next to +# copies assets/ to /opt/assets/ right next to # app.py, so the same "assets next to me" lookup works. # Probe the sibling path first (ISO case), fall back to the repo layout. def _resolve_assets_dir() -> Path: @@ -175,7 +175,7 @@ def _resolve_assets_dir() -> Path: sibling = here / "assets" if sibling.is_dir(): return sibling - repo_copy = here.parent / "furtka" / "assets" + repo_copy = here.parent / "assets" if repo_copy.is_dir(): return repo_copy raise FileNotFoundError( @@ -187,7 +187,7 @@ _ASSETS_DIR = _resolve_assets_dir() def _read_asset(relpath: str) -> str: - """Return the UTF-8 contents of an on-disk asset shipped under furtka/assets/. + """Return the UTF-8 contents of an on-disk asset shipped under assets/. Raises FileNotFoundError if the asset is missing, which is loud by design: an install that tries to write an asset that isn't there is broken before