From 78337bce722c3573d9fc6eafe345a3dbce4b9119 Mon Sep 17 00:00:00 2001 From: ibizaman Date: Tue, 15 Jul 2025 17:53:04 +0200 Subject: [PATCH] bootstrap: allow to give password from a file --- scripts/bootstrap.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index c52ca16..d28bf8a 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -691,8 +691,8 @@ main() { local user_config='' while read -r user_config; do - local field='' id='' email='' displayName='' firstName='' lastName='' avatar_file='' avatar_url='' gravatar_avatar='' weserv_avatar='' password='' - for field in 'id' 'email' 'displayName' 'firstName' 'lastName' 'avatar_file' 'avatar_url' 'gravatar_avatar' 'weserv_avatar' 'password'; do + local field='' id='' email='' displayName='' firstName='' lastName='' avatar_file='' avatar_url='' gravatar_avatar='' weserv_avatar='' password='' password_file='' + for field in 'id' 'email' 'displayName' 'firstName' 'lastName' 'avatar_file' 'avatar_url' 'gravatar_avatar' 'weserv_avatar' 'password' 'password_file'; do declare "$field"="$(printf '%s' "$user_config" | jq --raw-output --arg field "$field" '.[$field]')" done printf -- '\n--- %s ---\n' "$id" @@ -700,7 +700,9 @@ main() { create_update_user "$id" "$email" "$displayName" "$firstName" "$lastName" "$avatar_file" "$avatar_url" "$gravatar_avatar" "$weserv_avatar" redundant_users="$(printf '%s' "$redundant_users" | jq --compact-output --arg id "$id" '. - [$id]')" - if [[ "$password" != 'null' ]] && [[ "$password" != '""' ]]; then + if [[ "$password_file" != 'null' ]] && [[ "$password_file" != '""' ]]; then + "$LLDAP_SET_PASSWORD_PATH" --base-url "$LLDAP_URL" --token "$TOKEN" --username "$id" --password "$(cat $password_file)" + elif [[ "$password" != 'null' ]] && [[ "$password" != '""' ]]; then "$LLDAP_SET_PASSWORD_PATH" --base-url "$LLDAP_URL" --token "$TOKEN" --username "$id" --password "$password" fi