taler-exchange-helper-measure-none (2562B)
1 #!/bin/bash 2 # 3 # This file is part of TALER 4 # Copyright (C) 2014-2024 Taler Systems SA 5 # 6 # TALER is free software; you can redistribute it and/or modify it under the 7 # terms of the GNU General Public License as published by the Free Software 8 # Foundation; either version 3, or (at your option) any later version. 9 # 10 # TALER is distributed in the hope that it will be useful, but WITHOUT ANY 11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details. 13 # 14 # You should have received a copy of the GNU General Public License along with 15 # TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/license> 16 17 # This AMP is used as a dummy program for measures that just use an INFO check. 18 # 19 # It program fails when running it, but correctly responds to commands that try 20 # to inspect it. 21 22 # Hard error reporting on. 23 set -eu 24 25 # Exit, with error message (hard failure) 26 function exit_fail() { 27 echo " FAIL: " "$@" >&2 28 EXIT_STATUS=1 29 exit "$EXIT_STATUS" 30 } 31 32 CONF="$HOME/.config/taler-exchange.conf" 33 VERBOSE=0 34 35 while getopts 'ac:hirvV' OPTION; 36 do 37 case "$OPTION" in 38 a) 39 # No attributes are required. 40 exit 0 41 ;; 42 c) 43 # shellcheck disable=SC2034 44 CONF="$OPTARG" 45 ;; 46 h) 47 echo "This is a KYC measure program that freezes the account and flags it for manual investigation. This is the ultimate fallback measure." 48 echo 'Supported options:' 49 echo ' -a -- show required attributes' 50 # shellcheck disable=SC2016 51 echo ' -c $CONF -- set configuration' 52 echo ' -h -- print this help' 53 echo ' -i -- show required inputs' 54 echo ' -r -- show required context' 55 echo ' -v -- show version' 56 echo ' -V -- be verbose' 57 exit 0 58 ;; 59 i) 60 # No inputs are required 61 exit 0 62 ;; 63 r) 64 # No context is required. 65 exit 0 66 ;; 67 v) 68 echo "$0 v0.0.0" 69 exit 0 70 ;; 71 V) 72 VERBOSE=1 73 ;; 74 ?) 75 exit_fail "Unrecognized command line option" 76 ;; 77 esac 78 done 79 80 if [ 1 = "$VERBOSE" ]; then 81 echo "Running $0" 1>&2 82 fi 83 84 echo "FATAL: This measure program is a dummy and should never run. Only use it for INFO checks." >&2 85 86 exit 1