Skip to content

Commit 8a8d372

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

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed
 

‎android/scripts/update-lockfile.sh

+31-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@ 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."
13+
echo " This result is not reproducible. Also make sure to do an additional normal run afterwards."
14+
echo " -h Show this help page."
15+
}
16+
17+
while getopts 'rh' flag; do
18+
case "${flag}" in
19+
r) refresh_all_keys_flag=true ;;
20+
*) print_usage
21+
exit 1 ;;
22+
esac
23+
done
24+
825
# Disable daemon since it causes problems with the temp dir cleanup
926
# regardless if stopped.
1027
GRADLE_OPTS="-Dorg.gradle.daemon=false"
@@ -68,7 +85,20 @@ echo "Removing old components..."
6885
sed -i '/<components>/,/<\/components>/d' verification-metadata.xml
6986
echo ""
7087

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

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

0 commit comments

Comments
 (0)
Failed to load comments.