commit 532a652c72263619c5c796f78a22683ef017165a
parent 2a392311ccedc547310814f3173573cb945a4325
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Tue, 13 Aug 2024 13:20:23 +0200
update scripts for more uniform usage
Diffstat:
5 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/netzbon/README b/netzbon/README
@@ -0,0 +1,8 @@
+You need to install
+
+- jq
+- pdflatex (2023)
+- python3-jinja2
+- pdftk
+
+before using the scripts in this directory.
diff --git a/netzbon/generate-letter.sh b/netzbon/generate-letter.sh
@@ -6,15 +6,14 @@
#
# You must export
#
-# export BASE_URL=https://e.netzbon-basel.ch/
+# export BASE_DOMAIN=https://e.netzbon-basel.ch/
#
# before running this script!
#
set -eu
LENGTH=$(jq length < $1)
-echo "Generating $LENGTH letters for ${BASE_URL}"
-DOMAIN=$( echo "${BASE_URL}" | sed -e "s/https:\/\///" | sed -e "s/\/$//")
+echo "Generating $LENGTH letters for ${BASE_DOMAIN}"
mkdir -p export
mkdir -p tmp
@@ -24,7 +23,7 @@ do
INDEX=$(expr $n - 1 || true)
ID=$(jq -r .[$INDEX].id < $1)
- jq ".[$INDEX]" < $1 | jq '.domain="'"${DOMAIN}"'"' > "tmp/${ID}.json"
+ jq ".[$INDEX]" < $1 | jq '.domain="'"${BASE_DOMAIN}"'"' > "tmp/${ID}.json"
cd tmp
../render.py "${ID}.json" < ../template_de.tex.j2 > "${ID}.tex"
pdflatex "${ID}.tex" < /dev/null &> /dev/null || true
diff --git a/netzbon/generate-qr.sh b/netzbon/generate-qr.sh
@@ -6,15 +6,14 @@
#
# You must export
#
-# export BASE_URL=https://e.netzbon-basel.ch/
+# export BASE_DOMAIN=e.netzbon-basel.ch
#
# before running this script!
#
set -eu
LENGTH=$(jq length < $1)
-echo "Generating $LENGTH QR codes for ${BASE_URL}"
-DOMAIN=$( echo "${BASE_URL}" | sed -e "s/https:\/\///" | sed -e "s/\/$//")
+echo "Generating $LENGTH QR codes for ${BASE_DOMAIN}"
mkdir -p qre
mkdir -p tmp
@@ -24,7 +23,7 @@ do
INDEX=$(expr $n - 1 || true)
ID=$(jq -r .[$INDEX].id < $1)
- jq ".[$INDEX]" < $1 | jq '.domain="'"${DOMAIN}"'"' > "tmp/${ID}.json"
+ jq ".[$INDEX]" < $1 | jq '.domain="'"${BASE_DOMAIN}"'"' > "tmp/${ID}.json"
cd tmp
../render.py "${ID}.json" < ../qr.tex.j2 > "${ID}.tex"
pdflatex "${ID}.tex" < /dev/null &> /dev/null || true
diff --git a/netzbon/setup-merchants.sh b/netzbon/setup-merchants.sh
@@ -3,7 +3,7 @@
#
# You must export
#
-# export BASE_URL=e.netzbon-basel.ch
+# export BASE_DOMAIN=e.netzbon-basel.ch
# export MERCHANT_TOKEN=secret-token:...
# export BANK_ADMIN_PASSWORD=password
#
@@ -18,7 +18,7 @@
set -eu
LENGTH=$(jq length < $1)
-echo "Setting up $LENGTH merchants at ${BASE_URL}"
+echo "Setting up $LENGTH merchants at ${BASE_DOMAIN}"
for n in $(seq 1 $LENGTH)
do
@@ -28,8 +28,8 @@ do
ID=$(jq -r .[$INDEX].id < $1)
PW=$(jq -r .[$INDEX].pass < $1)
taler-harness deployment provision-bank-and-merchant \
- "https://backend.${BASE_URL}" \
- "https://bank.${BASE_URL}" \
+ "https://backend.${BASE_DOMAIN}" \
+ "https://bank.${BASE_DOMAIN}" \
"--merchant-management-token=${MERCHANT_TOKEN}" \
"--bank-admin-password=${BANK_ADMIN_PASSWORD}" \
"--id=${ID}" \
diff --git a/netzbon/test.json b/netzbon/test.json
@@ -3,5 +3,15 @@
"name": "Test shop",
"id": "test",
"pass": "password"
+ },
+ {
+ "name": "Test shop",
+ "id": "test2",
+ "pass": "password"
+ },
+ {
+ "name": "Test shop",
+ "id": "test3",
+ "pass": "password"
}
]