From: Frank Brehm Date: Thu, 10 Mar 2022 11:19:02 +0000 (+0100) Subject: Checking existence of password files before X-Git-Tag: 0.4.1^2~46 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=c0875c44c493fc22b9700a173630d2f1d4a31000;p=pixelpark%2Fpp-admin-tools.git Checking existence of password files before --- diff --git a/scripts/disabling-ldap-user b/scripts/disabling-ldap-user index 50e1025..18254ef 100755 --- a/scripts/disabling-ldap-user +++ b/scripts/disabling-ldap-user @@ -9,7 +9,7 @@ QUIET='n' SIMULATE='n' YES="n" -VERSION="1.3" +VERSION="1.4" # console colors: RED="" @@ -919,6 +919,25 @@ main() { trap cleanup_tmp_file INT TERM EXIT ABRT + empty_line + info "Checking existence of necessary password files ..." + local all_files_there="y" + for INSTANCE in "${USED_INSTANCES[@]}" ; do + BIND_PW_FILE="${BIND_PW_FILES[${INSTANCE}]}" + debug "Checking for '${CYAN}${BIND_PW_FILE}${NORMAL}'." + if [[ -f "${BIND_PW_FILE}" && -r "${BIND_PW_FILE}" ]] ; then + debug "Password file '${CYAN}${BIND_PW_FILE}${NORMAL}' exists and is readable." + else + error "Password file '${RED}${BIND_PW_FILE}${NORMAL}' does not exists or is not redable." + all_files_there="n" + fi + done + empty_line + + if [[ "${all_files_there}" == "n" ]] ; then + exit 6 + fi + for USER in "${USERS[@]}" ; do for INSTANCE in "${USED_INSTANCES[@]}" ; do LDAP_URL="${LDAP_URLS[${INSTANCE}]}"