diff --git a/update_psa_helpers b/update_psa_helpers index 85008e8..176c8a2 100755 --- a/update_psa_helpers +++ b/update_psa_helpers @@ -374,7 +374,43 @@ cleanup_previous_version() { } check_for_apism () { - nc localhost 7778 + local func="${FUNCNAME[0]}" + if nc localhost 7778; then + APISM_RUNNING=1 + log_debug "$func:${LINENO}: APISM running..." + return 0 + else + log_crit "$func:${LINENO}: *************************" + log_crit "$func:${LINENO}: !!! APISM NOT RUNNING !!!" + log_crit "$func:${LINENO}: *************************" + fi + return 1 +} + +check_default_route () { + if ip route | head -n 1 | grep -q '^default' + log_debug "$func:${LINENO}: default route set" + return 0 + then + log_crit "$func:${LINENO}: ***************************************" + log_crit "$func:${LINENO}: !!! NO DEFAULT ROUTE SET !!! Exiting..." + log_crit "$func:${LINENO}: ***************************************" + exit 1 + fi +} + +check_route_to_repository () { + # ip_address=$1, e.g. git.mimbach.de (185.191.219.134) + # 185.191.219.134 via 192.168.5.254 ... + if test "$#" -eq 1 && ip route get "$1" | head -n 1 | grep -q "^$1" + log_debug "$func:${LINENO}: route to repository available" + return 0 + then + log_crit "$func:${LINENO}: ***************************************" + log_crit "$func:${LINENO}: !!! NO ROUTE TO REPO SET !!! Exiting..." + log_crit "$func:${LINENO}: ***************************************" + exit 1 + fi } get_customer_id () {