Skip to content

Commit c8c2b14

Browse files
committedMar 17, 2025
Add the ability to refresh all keys
1 parent 3d2fc56 commit c8c2b14

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed
 

‎android/scripts/update-lockfile.sh

+30-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ set -eu
55
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
66
cd "$SCRIPT_DIR"
77

8+
refresh_all_keys_flag=false
9+
10+
print_usage() {
11+
echo "Usage:"
12+
echo " -r Refresh all keys, will remove all trusted keys and clear the keyring, allowing for old keys to removed and keys entries to be updated. This result is not reproducable."
13+
echo " -h Show this help page."
14+
}
15+
16+
while getopts 'rh' flag; do
17+
case "${flag}" in
18+
r) refresh_all_keys_flag=true ;;
19+
*) print_usage
20+
exit 1 ;;
21+
esac
22+
done
23+
824
# Disable daemon since it causes problems with the temp dir cleanup
925
# regardless if stopped.
1026
GRADLE_OPTS="-Dorg.gradle.daemon=false"
@@ -68,7 +84,20 @@ echo "Removing old components..."
6884
sed -i '/<components>/,/<\/components>/d' verification-metadata.xml
6985
echo ""
7086

71-
echo "Generating new trusted keys..."
87+
88+
if [ "$refresh_all_keys_flag" = true ]; then
89+
echo "Refreshing all keys"
90+
91+
echo "Removing old trusted keys..."
92+
sed -i '/<trusted-keys>/,/<\/trusted-keys>/d' verification-metadata.xml
93+
echo ""
94+
95+
echo "Removing old keyring..."
96+
rm verification-keyring.keys
97+
echo ""
98+
fi
99+
100+
echo "Generating new trusted keys & updating keyring..."
72101
../gradlew -q -p .. --project-cache-dir "$TEMP_GRADLE_PROJECT_CACHE_DIR" -M pgp,sha256 "${GRADLE_TASKS[@]}" --export-keys
73102

74103
echo "Sorting keyring and removing duplicates..."

0 commit comments

Comments
 (0)
Failed to load comments.