diff options
author | Antoine A <> | 2024-02-29 15:23:26 +0100 |
---|---|---|
committer | Antoine A <> | 2024-02-29 17:45:42 +0100 |
commit | 6f0b35ef80d92daa15f6feb40cadbd6769c711fa (patch) | |
tree | c4e427355c676b90be65f54655f78697b7397171 | |
parent | 227c55fc0d9199db73e3efb37792309fa16b546e (diff) | |
parent | 6ed69587af163a52ae3ad159654503d72a45055d (diff) | |
download | deployment-6f0b35ef80d92daa15f6feb40cadbd6769c711fa.tar.gz deployment-6f0b35ef80d92daa15f6feb40cadbd6769c711fa.tar.bz2 deployment-6f0b35ef80d92daa15f6feb40cadbd6769c711fa.zip |
Merge commit '6ed69587af163a52ae3ad159654503d72a45055d'
-rwxr-xr-x | regional-currency/ask_questions.py | 51 | ||||
-rwxr-xr-x | regional-currency/functions.sh | 7 | ||||
-rwxr-xr-x | regional-currency/install_packages.sh | 12 | ||||
-rwxr-xr-x | regional-currency/setup-exchange.sh | 31 |
4 files changed, 96 insertions, 5 deletions
diff --git a/regional-currency/ask_questions.py b/regional-currency/ask_questions.py index de5f6dc..c3b9875 100755 --- a/regional-currency/ask_questions.py +++ b/regional-currency/ask_questions.py @@ -203,6 +203,31 @@ def ask_host(name: str, msg: str, default: str | None = None) -> str: return ask(name, msg, default, check_host) +def ask_terms(name: str, msg: str, kind: str) -> str: + "Prompt the user to select a ToS/privacy policy" + + # msg = "9.1. Enter the filename of the ToS. Some available options are:\n" + tos_msg = msg + + # Recollect example ToS files + tos_path = "/usr/share/taler/terms" + for f in os.listdir(tos_path): + tos_file = os.path.join(tos_path, f) + if os.path.isfile(tos_file) and f.endswith(".rst") and kind in f: + tos_msg += f"- {tos_file}\n" + + tos_msg += "=> " + + def check_file(path: str) -> str | None: + if not os.path.isfile(path): + print("Not a file") # Checksum check ? + return None + else: + return path + + return ask(name, tos_msg, None, check_file) + + def ask_yes_no(name: str | None, msg: str, default: bool | None = None) -> bool: "Prompt the user to configure a boolean" @@ -276,7 +301,9 @@ if ask_yes_no("ENABLE_TLS", "5. Setup TLS using Let's Encrypt? (Y/n): ", True): else: add_conf("PROTO", "http") -add_conf("DO_OFFLINE", "y") # TODO support offline setup again when the documentation is ready +add_conf( + "DO_OFFLINE", "y" +) # TODO support offline setup again when the documentation is ready if ask_yes_no( "DO_TELESIGN", @@ -315,3 +342,25 @@ ask_str( "7. Enter the admin password for the bank (or press enter to autogenerate password): ", str(uuid.uuid4()), ) + +if ask_yes_no( + "DO_EXCHANGE_TERMS", + "8. Do you wish to configure terms of service (ToS) for the exchange? (Y/n): ", + True, +): + ask_terms( + "EXCHANGE_TERMS_FILE", + "8.1. Enter the filename of the ToS. Some available options are:\n", + "-tos-", + ) + +if ask_yes_no( + "DO_EXCHANGE_PRIVACY", + "9. Do you wish to configure a privacy policy for the exchange? (Y/n): ", + True, +): + ask_terms( + "EXCHANGE_PRIVACY_FILE", + "9.1. Enter the filename of the privacy policy. Some available options are:\n", + "-pp-", + ) diff --git a/regional-currency/functions.sh b/regional-currency/functions.sh index 749d1bd..0663fec 100755 --- a/regional-currency/functions.sh +++ b/regional-currency/functions.sh @@ -26,10 +26,11 @@ function check_user() { # status if distro not supported. function detect_distro() { unset DISTRO + [[ -f /etc/os-release ]] && source /etc/os-release # shellcheck disable=SC2034 - uname -a | grep Ubuntu >/dev/null && DISTRO=ubuntu && return 0 + echo $NAME | grep Ubuntu >/dev/null && DISTRO=ubuntu && return 0 # shellcheck disable=SC2034 - uname -a | grep Debian >/dev/null && DISTRO=debian && return 0 + echo $NAME | grep Debian >/dev/null && DISTRO=debian && return 0 echo "Unsupported distro, should be either ubuntu or debian" >&2 return 1 -}
\ No newline at end of file +} diff --git a/regional-currency/install_packages.sh b/regional-currency/install_packages.sh index a698b1a..710ba0d 100755 --- a/regional-currency/install_packages.sh +++ b/regional-currency/install_packages.sh @@ -30,8 +30,18 @@ apt install uuid-runtime \ postgresql-client-${PG_VERSION} \ dbconfig-pgsql \ certbot \ + latexmk \ + texlive-latex-extra \ + texlive-latex-recommended \ + tex-gyre \ + python3-sphinx \ + python3-pip \ python3-certbot-nginx -y &>> setup.log +pip3 install --break-system-packages \ + sphinx-markdown-builder \ + htmlark + ## Add GNU Taler deb.taler.net to /etc/apt/sources.list say "Adding GNU Taler apt repository" @@ -63,4 +73,4 @@ apt install taler-exchange \ taler-wallet-cli \ taler-exchange-offline \ libeufin-bank \ - libeufin-nexus -y &>> setup.log
\ No newline at end of file + libeufin-nexus -y &>> setup.log diff --git a/regional-currency/setup-exchange.sh b/regional-currency/setup-exchange.sh index fe50426..e4aff34 100755 --- a/regional-currency/setup-exchange.sh +++ b/regional-currency/setup-exchange.sh @@ -100,6 +100,34 @@ systemctl stop taler-exchange.target &>> setup.log say "Configuring exchange" +# Generate terms of service (ToS) +TERMS_ETAG= +if test ${DO_EXCHANGE_TERMS} == y; then + if test -z "${EXCHANGE_TERMS_FILE:-}"; then + say "Error: No EXCHANGE_TERMS_FILE set but DO_EXCHANGE_TERMS set to YES" + exit 1 + fi + + TERMS_ETAG="$(basename "$EXCHANGE_TERMS_FILE" .rst)" + + say "Setting up terms of service (ToS)" + taler-terms-generator -i "${EXCHANGE_TERMS_FILE}" &>> setup.log +fi + +# Generate privacy policy +PRIVACY_ETAG= +if test ${DO_EXCHANGE_PRIVACY} == y; then + if test -z "${EXCHANGE_PRIVACY_FILE:-}"; then + say "Error: No EXCHANGE_PRIVACY_FILE set but DO_EXCHANGE_PRIVACY set to YES" + exit 1 + fi + + PRIVACY_ETAG="$(basename "$EXCHANGE_PRIVACY_FILE" .rst)" + + say "Setting up the privacy policy" + taler-terms-generator -i "${EXCHANGE_PRIVACY_FILE}" &>> setup.log +fi + export EXCHANGE_BASE_URL="$PROTO://exchange.${DOMAIN_NAME}/" cat << EOF > /etc/taler/conf.d/setup.conf @@ -115,6 +143,9 @@ STEFAN_ABS=${CURRENCY}:0 STEFAN_LOG=${CURRENCY}:0 STEFAN_LIN=0 +TERMS_ETAG=${TERMS_ETAG} +PRIVACY_ETAG=${PRIVACY_ETAG} + [merchant-exchange-${DOMAIN_NAME}] MASTER_KEY=${MASTER_PUBLIC_KEY} CURRENCY=${CURRENCY} |