Skip to content

Commit

Permalink
try awk
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Crawford <[email protected]>
  • Loading branch information
stephen-crawford committed Sep 22, 2023
1 parent 011509f commit 72440cf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/install_demo_configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,13 @@ echo "ADMIN TARGET FILE LINE SET TO: $ADMIN_HASH_LINE"

echo "Before CHANGE: $(cat $INTERNAL_USERS_FILE)"

awk -v hashed_admin_password="$HASHED_ADMIN_PASSWORD" '
/^ *hash: *"\$2a\$12\$VcCDgh2NDk07JGN0rjGbM.Ad41qVR\/YFJcgHp0UGns5JDymv..TOG"/ {
sub(/"\$2a\$12\$VcCDgh2NDk07JGN0rjGbM.Ad41qVR\/YFJcgHp0UGns5JDymv..TOG"/, "\"" hashed_admin_password "\"");
}
{ print }
' "$INTERNAL_USERS_FILE" > temp_file && mv temp_file "$INTERNAL_USERS_FILE"

sed -ri "s/^(\\s*hash:\\s*)\"\\\$2a\\\$12\\\$VcCDgh2NDk07JGN0rjGbM.Ad41qVR\/YFJcgHp0UGns5JDymv..TOG\"/\\1\"\\$HASHED_ADMIN_PASSWORD\"//" "$INTERNAL_USERS_FILE"

echo "AFTER CHANGE: $(cat $INTERNAL_USERS_FILE)"

Expand Down

0 comments on commit 72440cf

Please sign in to comment.