Skip to content

Commit 2e2fdaf

Browse files
committed
Use secret in agent mode to insert password just once
Signed-off-by: Muntashir Al-Islam <muntashirakon@riseup.net>
1 parent 43881cd commit 2e2fdaf

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

scripts/aab_to_apks.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,20 @@ SUPPORTED_DPIS=(ldpi mdpi tvdpi hdpi xhdpi xxhdpi xxxhdpi)
4242
SUPPORTED_ARCHS=(armeabi_v7a arm64_v8a x86 x86_64)
4343

4444
if [[ -f $(which secret) ]]; then
45-
echo "Using secret (https://github.com/angt/secret) for secrets...";
46-
KEYSTORE_PASS=$(secret show android_keystore)
47-
if [[ "$KEYSTORE_PASS" == "" ]]; then
48-
echo "android_keystore does not exists."
45+
echo "Using secret (https://github.com/angt/secret) for secrets..."
46+
47+
eval "$(secret agent bash -c '
48+
printf "KEYSTORE_PASS=%q\n" "$(secret show android_keystore)"
49+
printf "KEY_ALIAS_PASS=%q\n" "$(secret show android_keystore_alias_key0)"
50+
')"
51+
52+
if [[ -z "$KEYSTORE_PASS" ]]; then
53+
echo "android_keystore does not exist."
54+
elif [[ -z "$KEY_ALIAS_PASS" ]]; then
55+
echo "android_keystore_alias_key0 does not exist."
4956
else
50-
KEY_ALIAS_PASS=$(secret show android_keystore_alias_key0)
51-
if [[ "$KEY_ALIAS_PASS" == "" ]]; then
52-
echo "android_keystore_alias_key0 does not exists."
53-
else
54-
KEYSTORE=~/keystores/android_keystore.jks
55-
KEY_ALIAS=key0
56-
fi
57+
KEYSTORE=~/keystores/android_keystore.jks
58+
KEY_ALIAS=key0
5759
fi
5860
fi
5961

0 commit comments

Comments
 (0)