koopa-admin-log/scripts/taler-merchant/install_dual_terms.sh
Hernâni Marques 54ebdb7d7a
configs: rename dirs to match live koopa containers
Reflect host naming in git paths:
- configs/taler-hacktivism/ (was taler-merchant) → container taler-hacktivism
- configs/taler-hacktivism-bank/ (was taler-bank) → container …-bank,
  image taler-hacktivism-banking:live
- configs/taler-exchange-ansible/ already matches …-exchange-ansible
- configs/taler-exchange/ = conf inside that exchange container

Update LIVE.md, README, ports/refs. No secret values.
2026-07-10 16:02:52 +02:00

232 lines
9.4 KiB
Bash

#!/bin/bash
# Install dual-currency "No Formal Terms" ToS for the merchant backend.
# Run as root inside the merchant container (taler-hacktivism).
#
# Sets files under TERMS_DIR/en/ for TERMS_ETAG = merchant-tos-dual-v0
# (see configs/taler-hacktivism/merchant-overrides.conf).
set -euo pipefail
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${PATH:+:$PATH}"
ETAG="${TERMS_ETAG:-merchant-tos-dual-v2}"
CONF="${TALER_MERCHANT_CONFIG:-/etc/taler-merchant/taler-merchant.conf}"
DATA_HOME=""
if command -v taler-config >/dev/null 2>&1; then
DATA_HOME=$(taler-config -c "$CONF" -f -s PATHS -o TALER_DATA_HOME 2>/dev/null || true)
fi
# common fallbacks
for d in \
"$DATA_HOME" \
/var/lib/taler-merchant/ \
/var/lib/taler-merchant
do
[ -n "${d:-}" ] || continue
d="${d%/}/"
if [ -d "$d" ] || mkdir -p "$d" 2>/dev/null; then
DATA_HOME="$d"
break
fi
done
DATA_HOME="${DATA_HOME:-/var/lib/taler-merchant/}"
TERMS_DIR="${TERMS_DIR:-${DATA_HOME%/}/terms}"
LANG_DIR="$TERMS_DIR/en"
mkdir -p "$LANG_DIR"
TITLE="No Formal Terms · Dual Currency Notice"
BODY_MD='# No Formal Terms · Dual Currency Notice
This is a **self-hosted GNU Taler merchant backend** at `taler.hacktivism.ch` (hacktivism.ch).
**No formal terms of service** from Taler Operations AG (or any other third-party portal operator) apply to this instance. This short notice is the site policy for using the backend.
## Dual currency
This backend is configured for **two currencies at once**:
- **GOA** — explorational / experimental currency of the local stack (`exchange.hacktivism.ch`, `bank.hacktivism.ch`). GOA is **not** legal tender. It has **no guaranteed real-world value**, redemption, or convertibility.
- **CHF** — Swiss francs, a **real** currency. CHF amounts are real money settled via the CHF exchange configured on this host (taler-ops / TOPS infrastructure as deployed). Treat CHF with the seriousness of ordinary payments.
By creating a merchant instance, accepting payments, or otherwise using this service you acknowledge that:
- GOA is for exploration and testing only.
- CHF involves real money — only use funds you control and can afford to risk on a self-hosted experimental stack.
- There is no guaranteed availability, support, or uptime.
- Operators may reset GOA state, change configuration, delete instance data, or interrupt service without notice.
- Software is provided as-is, without warranty.
If you do not agree, do not use this merchant backend.
## Related
- Exchange (GOA): https://exchange.hacktivism.ch/terms
- Bank intro: https://bank.hacktivism.ch/intro/
- Merchant intro: https://taler.hacktivism.ch/intro/
'
BODY_TXT='No Formal Terms · Dual Currency Notice
This is a self-hosted GNU Taler merchant backend at taler.hacktivism.ch (hacktivism.ch).
No formal terms of service from Taler Operations AG (or any other third-party portal operator) apply to this instance. This short notice is the site policy for using the backend.
Dual currency
-------------
This backend is configured for two currencies at once:
- GOA — explorational / experimental currency of the local stack
(exchange.hacktivism.ch, bank.hacktivism.ch). GOA is not legal tender.
It has no guaranteed real-world value, redemption, or convertibility.
- CHF — Swiss francs, a real currency. CHF amounts are real money
settled via the CHF exchange configured on this host (taler-ops / TOPS
infrastructure as deployed). Treat CHF with the seriousness of
ordinary payments.
By creating a merchant instance, accepting payments, or otherwise using
this service you acknowledge that:
- GOA is for exploration and testing only.
- CHF involves real money — only use funds you control and can afford
to risk on a self-hosted experimental stack.
- There is no guaranteed availability, support, or uptime.
- Operators may reset GOA state, change configuration, delete instance
data, or interrupt service without notice.
- Software is provided as-is, without warranty.
If you do not agree, do not use this merchant backend.
Related
-------
- Exchange (GOA): https://exchange.hacktivism.ch/terms
- Bank intro: https://bank.hacktivism.ch/intro/
- Merchant intro: https://taler.hacktivism.ch/intro/
'
printf '%s\n' "$BODY_TXT" >"$LANG_DIR/${ETAG}.txt"
printf '%s\n' "$BODY_MD" >"$LANG_DIR/${ETAG}.md"
# HTML (browser-friendly; style close to exchange short terms)
cat >"$LANG_DIR/${ETAG}.html" <<HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>${TITLE}</title>
<style>
:root { color-scheme: dark light; }
body {
font-family: system-ui, -apple-system, sans-serif;
max-width: 40rem; margin: 2rem auto; padding: 0 1.1rem 3rem;
line-height: 1.5; color: #e8e6e3; background: #1a1520;
}
h1 { font-size: 1.35rem; font-weight: 800; margin: 0 0 1rem; color: #f5f0ea; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 0.5rem; color: #e8c878; }
p, li { font-size: 0.98rem; }
ul { padding-left: 1.2rem; }
code, a { color: #5eead4; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.badge {
display: inline-block; font-size: 0.72rem; font-weight: 700;
letter-spacing: 0.06em; text-transform: uppercase;
color: #c4b5fd; border: 1px solid rgba(196,181,253,0.35);
border-radius: 999px; padding: 0.2rem 0.65rem; margin-bottom: 0.85rem;
}
.pair {
display: grid; gap: 0.65rem; margin: 0.85rem 0 1rem;
}
@media (min-width: 520px) { .pair { grid-template-columns: 1fr 1fr; } }
.cur {
border-radius: 12px; padding: 0.75rem 0.9rem;
border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.25);
}
.cur strong { display: block; font-size: 1.05rem; margin-bottom: 0.25rem; }
.cur.go a, .cur.go strong { color: #5eead4; }
.cur.chf strong { color: #e8c878; }
.muted { color: #a39e98; font-size: 0.88rem; }
footer { margin-top: 2rem; font-size: 0.85rem; color: #a39e98; }
</style>
</head>
<body>
<div class="badge">taler.hacktivism.ch · merchant</div>
<h1>${TITLE}</h1>
<p>This is a <strong>self-hosted GNU Taler merchant backend</strong> at
<code>taler.hacktivism.ch</code> (hacktivism.ch).</p>
<p><strong>No formal terms of service</strong> from Taler Operations AG
(or any other third-party portal operator) apply to this instance.
This short notice is the site policy for using the backend.</p>
<h2>Dual currency</h2>
<p>This backend is configured for <strong>two currencies at once</strong>:</p>
<div class="pair">
<div class="cur go">
<strong>GOA · explorational</strong>
Local stack currency
(<a href="https://exchange.hacktivism.ch/">exchange</a>,
<a href="https://bank.hacktivism.ch/intro/">bank</a>).
Not legal tender. No guaranteed real-world value, redemption, or convertibility.
</div>
<div class="cur chf">
<strong>CHF · real</strong>
Swiss francs. Real money, settled via the CHF exchange configured
on this host (taler-ops / TOPS infrastructure as deployed).
Treat CHF with the seriousness of ordinary payments.
</div>
</div>
<h2>By using this service you acknowledge</h2>
<ul>
<li>GOA is for exploration and testing only.</li>
<li>CHF involves real money — only use funds you control and can afford to risk on a self-hosted experimental stack.</li>
<li>There is no guaranteed availability, support, or uptime.</li>
<li>Operators may reset GOA state, change configuration, delete instance data, or interrupt service without notice.</li>
<li>Software is provided as-is, without warranty.</li>
</ul>
<p>If you do not agree, do not use this merchant backend.</p>
<h2>Related</h2>
<ul>
<li><a href="https://exchange.hacktivism.ch/terms">Exchange terms (GOA)</a></li>
<li><a href="https://bank.hacktivism.ch/intro/">Bank intro</a></li>
<li><a href="https://taler.hacktivism.ch/intro/">Merchant intro</a></li>
<li><a href="https://taler.hacktivism.ch/privacy">Merchant privacy</a></li>
</ul>
<h2>Privacy</h2>
<p class="muted">Processing under Swiss FADP (revDSG). What data is retained
(instances, orders, deposits, logs, …) is listed on
<a href="https://taler.hacktivism.ch/privacy">/privacy</a>.</p>
<footer class="muted">Version ${ETAG} · hacktivism.ch</footer>
</body>
</html>
HTML
# Optional PDF so Accept: */* / wallets preferring PDF still get content
PDF="$LANG_DIR/${ETAG}.pdf"
if command -v pandoc >/dev/null 2>&1; then
if pandoc -f markdown -t pdf -o "$PDF" "$LANG_DIR/${ETAG}.md" 2>/dev/null; then
echo "pdf via pandoc: $PDF"
elif command -v wkhtmltopdf >/dev/null 2>&1; then
wkhtmltopdf "$LANG_DIR/${ETAG}.html" "$PDF" 2>/dev/null && echo "pdf via wkhtmltopdf" || true
fi
elif command -v wkhtmltopdf >/dev/null 2>&1; then
wkhtmltopdf "$LANG_DIR/${ETAG}.html" "$PDF" 2>/dev/null && echo "pdf via wkhtmltopdf" || true
fi
# If no PDF toolchain: leave absent — httpd will serve md/html/txt by Accept
chmod -R a+rX "$TERMS_DIR"
if id taler-merchant-httpd >/dev/null 2>&1; then
chown -R taler-merchant-httpd: "$TERMS_DIR" 2>/dev/null \
|| chown -R taler-merchant-httpd:www-data "$TERMS_DIR" 2>/dev/null \
|| true
fi
echo "Installed under $LANG_DIR:"
ls -la "$LANG_DIR"/${ETAG}.* 2>/dev/null || ls -la "$LANG_DIR"
echo
echo "Config should set:"
echo " [merchant]"
echo " TERMS_ETAG = ${ETAG}"
echo " TERMS_DIR = \${TALER_DATA_HOME}terms/"
echo "Then restart taler-merchant-httpd."