Files
rust-package-builder/scripts/generate-opnsense-index.sh
T
2026-10-07 09:23:17 +02:00

72 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -Eeuo pipefail
source /opt/rust-package-builder/scripts/lib.sh
OUT=${1:?output file required}
URL=$(trim_trailing_slash "$OPNSENSE_REPOSITORY_URL")
PACKAGE=${PACKAGE_NAME:-rustproxy}
export OUT URL PACKAGE OPNSENSE_ABI FREEBSD_ABI
python3 <<'PY'
import html
import os
out = os.environ["OUT"]
url = os.environ["URL"]
package = os.environ["PACKAGE"]
series = os.environ["OPNSENSE_ABI"]
abi = os.environ["FREEBSD_ABI"]
h = html.escape
content = f'''<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>RustProxy OPNsense repository</title>
<style>
:root{{color-scheme:light dark;font-family:system-ui,-apple-system,"Segoe UI",sans-serif}}
body{{max-width:900px;margin:0 auto;padding:42px 20px 70px;line-height:1.55}}
.card{{border:1px solid #8885;border-radius:12px;padding:18px;margin:18px 0}}
pre{{overflow:auto;padding:16px;border-radius:9px;background:#111;color:#eee}}
code{{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}}
</style>
</head>
<body>
<h1>RustProxy OPNsense repository</h1>
<p>FreeBSD pkg repository for the <code>os-rustproxy</code> OPNsense plugin.</p>
<div class="card">
<p><strong>Repository:</strong> {h(url)}</p>
<p><strong>OPNsense series:</strong> {h(series)} &nbsp; <strong>ABI:</strong> {h(abi)}</p>
</div>
<div class="card">
<h2>pkg repository configuration</h2>
<pre><code>mkdir -p /usr/local/etc/pkg/repos
cat &gt; /usr/local/etc/pkg/repos/RustProxy.conf &lt;&lt;'REPO'
RustProxy: {{
url: "{h(url)}",
enabled: yes,
mirror_type: "none",
signature_type: "none"
}}
REPO
pkg update -f
pkg install os-rustproxy</code></pre>
</div>
<div class="card">
<h2>Repository metadata</h2>
<ul>
<li><a href="{h(url)}/RustProxy.conf">RustProxy.conf</a> - ready pkg repo configuration</li>
<li><a href="{h(url)}/meta.conf">meta.conf</a></li>
<li><a href="{h(url)}/packagesite.pkg">packagesite.pkg</a></li>
<li><a href="{h(url)}/data.pkg">data.pkg</a></li>
<li><a href="{h(url)}/os-rustproxy-latest.pkg">latest package</a></li>
</ul>
</div>
</body>
</html>
'''
with open(out, "w", encoding="utf-8") as f:
f.write(content)
PY