Files
rust-package-builder/scripts/generate-freebsd-index.sh
T
2026-10-22 13:03:12 +02:00

31 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
set -Eeuo pipefail
BUILDER_ROOT=${BUILDER_ROOT:-/opt/rust-package-builder}
source "$BUILDER_ROOT/scripts/lib.sh"
OUT=${1:?output file required}
URL="${OPNSENSE_REPOSITORY_URL%/}/freebsd"
export OUT URL FREEBSD_ABI
python3 <<'PY'
import html, os
h=html.escape
url=h(os.environ['URL']); abi=h(os.environ['FREEBSD_ABI'])
page=f'''<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>RustProxy - native FreeBSD pkg</title>
<style>body{{font:16px/1.55 system-ui,sans-serif;max-width:860px;margin:40px auto;padding:0 20px}}pre{{overflow:auto;background:#171717;color:#eee;padding:18px;border-radius:8px}}</style></head>
<body><h1>RustProxy for native FreeBSD</h1>
<p>This repository contains the <code>rustproxy</code> package and an rc.d service, without OPNsense plugin files. ABI: <code>{abi}</code>.</p>
<p><strong>Development repository: unsigned pkg catalog.</strong> Use only in an environment where you trust the source and transport. Configure signing before production.</p>
<pre><code>mkdir -p /usr/local/etc/pkg/repos
fetch -o /usr/local/etc/pkg/repos/RustProxy-FreeBSD.conf {url}/RustProxy-FreeBSD.conf
pkg update -f
pkg install rustproxy
sysrc rustproxy_enable=YES
service rustproxy start
service rustproxy reload</code></pre>
<p>To use an external JSON configuration, set <code>rustproxy_config="/usr/local/etc/rustproxy/config.json"</code> in <code>/etc/rc.conf</code>. The file and parent directory must be writable by the service account.</p>
<ul><li><a href="{url}/meta.conf">meta.conf</a></li><li><a href="{url}/packagesite.pkg">packagesite.pkg</a></li><li><a href="{url}/RustProxy-FreeBSD.conf">RustProxy-FreeBSD.conf</a></li><li><a href="{url}/rustproxy-latest.pkg">latest package</a></li></ul>
</body></html>'''
with open(os.environ['OUT'],'w',encoding='utf-8') as f:
f.write(page)
PY