Created
March 5, 2025 12:37
-
-
Save frafra/0a9a2da7bd12d9b0263f18ca88f9da50 to your computer and use it in GitHub Desktop.
Snippets for IPT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
OLD_PASSWORD="old_endoded_pwd" | |
NEW_PASSWORD="new_endoded_pwd" | |
filter='(.resource.sources | (.sqlsource, .sqlsources[])? | select(.password == $old).password) |= $new' | |
for file in */resource.xml; do | |
xq --xml-output --arg old "$OLD_PASSWORD" --arg new "$NEW_PASSWORD" "$filter" "$file" > "${file}.tmp" | |
if cmp -s <(xq --xml-output . "$file") "${file}.tmp"; then | |
rm "${file}.tmp" | |
else | |
mv "${file}.tmp" "$file" | |
echo "Updated password in: $file" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment