mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-10-07 05:56:40 +00:00
refactor(oci): remove the shell entry point nothing runs
`oci/proxmenux-oci.sh` was installed on every Proxmox host and used on none of them. The menu entry goes straight to the orchestrator: scripts/oci/oci_manager_apps.sh runs `python3 -m proxmenux_oci` with PYTHONPATH pointing at the engine. Its only remaining caller was a message telling the reader to open it on the Proxmox host — which is not how anyone gets in, and is what sent one there to run it. That message now names the menu entry. It could not be fetched and run either: it needs requirements.txt and src/ beside it, so `wget | bash` resolved its own directory to the working directory and failed on a path nobody chose. Making that work would mean writing a second installer next to the one that already ships the engine. What it did offer was a virtualenv for a contributor generating the catalog. The README now gives the direct invocation and names the two distribution packages it needs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
Runtime distribution only:
|
||||
|
||||
- `proxmenux-oci.sh`: entry point, run from this directory.
|
||||
- `catalog/`: index, application templates, curated definitions and overlays.
|
||||
- `src/`: menu and deployment orchestrator.
|
||||
- `remote/`: native Proxmox OCI/LXC installation and lifecycle helpers.
|
||||
|
||||
+10
-12
@@ -58,26 +58,24 @@ compatible merely because conversion succeeded.
|
||||
|
||||
## Catalog maintenance
|
||||
|
||||
The catalog is generated rather than written by hand. `proxmenux-oci.sh` is the
|
||||
tool that produces and inspects it, and it is what a contributor adding an
|
||||
application runs:
|
||||
The catalog is generated rather than written by hand. A contributor adding an
|
||||
application runs the orchestrator directly from this directory:
|
||||
|
||||
```bash
|
||||
./proxmenux-oci.sh sync
|
||||
./proxmenux-oci.sh list --filter sonarr
|
||||
./proxmenux-oci.sh generate sonarr
|
||||
./proxmenux-oci.sh show sonarr
|
||||
GITHUB_TOKEN=github_pat_xxx ./proxmenux-oci.sh generate-all
|
||||
export PYTHONPATH=src
|
||||
python3 -m proxmenux_oci sync
|
||||
python3 -m proxmenux_oci list --filter sonarr
|
||||
python3 -m proxmenux_oci generate sonarr
|
||||
python3 -m proxmenux_oci show sonarr
|
||||
GITHUB_TOKEN=github_pat_xxx python3 -m proxmenux_oci generate-all
|
||||
```
|
||||
|
||||
`generate` writes one application's template from its published recipe; `show`
|
||||
prints what the installation would create, which is the fastest way to see
|
||||
whether a translation came out right before installing anything.
|
||||
|
||||
On Debian and Proxmox the launcher reuses the distribution packages
|
||||
`python3-yaml` and `python3-jsonschema` when they are present, so nothing is
|
||||
installed into the system Python. Where they are absent, install them with APT
|
||||
before generating the catalog.
|
||||
It needs `python3-yaml` and `python3-jsonschema`. On Debian and Proxmox both
|
||||
are distribution packages; install them with APT before generating the catalog.
|
||||
|
||||
`GITHUB_TOKEN` is optional and only raises the public API rate limit, which the
|
||||
full `generate-all` pass reaches. Never commit a token; `.env` files are
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
VENV_DIR="$ROOT_DIR/.venv"
|
||||
REQUIREMENTS="$ROOT_DIR/requirements.txt"
|
||||
STAMP="$VENV_DIR/.requirements.sha256"
|
||||
|
||||
# The orchestrator lives beside this script, so it has to run from where it
|
||||
# was installed. Piped from a URL there is no directory to read: $0 is "bash",
|
||||
# ROOT_DIR becomes the working directory, and the first missing file reports a
|
||||
# path nobody asked for.
|
||||
if [ ! -r "$REQUIREMENTS" ] || [ ! -d "$ROOT_DIR/src/proxmenux_oci" ]; then
|
||||
cat >&2 <<EOF
|
||||
ERROR: this script runs from the directory it was installed in, next to
|
||||
requirements.txt and src/. It cannot be piped from a URL.
|
||||
|
||||
On a Proxmox host with ProxMenux installed:
|
||||
/usr/local/share/proxmenux/oci/engine/proxmenux-oci.sh "\$@"
|
||||
|
||||
From a clone of the repository:
|
||||
cd oci && ./proxmenux-oci.sh "\$@"
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
command -v python3 >/dev/null 2>&1 || {
|
||||
echo "ERROR: Python 3 is required." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if python3 -c 'import yaml, jsonschema' >/dev/null 2>&1; then
|
||||
PYTHON=python3
|
||||
else
|
||||
if [[ ! -x "$VENV_DIR/bin/python" ]] || ! "$VENV_DIR/bin/python" -m pip --version >/dev/null 2>&1; then
|
||||
echo "Preparing the local Python environment..."
|
||||
rm -rf "$VENV_DIR"
|
||||
python3 -m venv "$VENV_DIR" || {
|
||||
echo "ERROR: could not create the virtual environment. On Debian, install python3-venv, python3-yaml and python3-jsonschema." >&2
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
if command -v shasum >/dev/null 2>&1; then
|
||||
CURRENT_HASH=$(shasum -a 256 "$REQUIREMENTS" | awk '{print $1}')
|
||||
else
|
||||
CURRENT_HASH=$(sha256sum "$REQUIREMENTS" | awk '{print $1}')
|
||||
fi
|
||||
INSTALLED_HASH=$(cat "$STAMP" 2>/dev/null || true)
|
||||
if [[ "$CURRENT_HASH" != "$INSTALLED_HASH" ]]; then
|
||||
echo "Installing the converter dependencies..."
|
||||
"$VENV_DIR/bin/python" -m pip install --disable-pip-version-check -r "$REQUIREMENTS"
|
||||
printf '%s\n' "$CURRENT_HASH" >"$STAMP"
|
||||
fi
|
||||
PYTHON="$VENV_DIR/bin/python"
|
||||
fi
|
||||
|
||||
export PYTHONPATH="$ROOT_DIR/src${PYTHONPATH:+:$PYTHONPATH}"
|
||||
exec "$PYTHON" -m proxmenux_oci "$@"
|
||||
@@ -141,7 +141,7 @@ def interactive_management(project, ui):
|
||||
|
||||
def _interactive_management(project, ui):
|
||||
if os.geteuid() != 0 or not shutil.which('pct'):
|
||||
ui.message(translate('This interface runs on the Proxmox node as root. Open proxmenux-oci.sh on the Proxmox host.'), translate('OCI management'))
|
||||
ui.message(translate('This interface runs on the Proxmox node as root. Open OCI manager Apps from the ProxMenux menu on the Proxmox host.'), translate('OCI management'))
|
||||
return
|
||||
rows = saved_inventory(project)
|
||||
if not rows:
|
||||
|
||||
Reference in New Issue
Block a user