forked from xafero/java-keyring
-
Notifications
You must be signed in to change notification settings - Fork 12
/
.setupkeystore.sh
executable file
·44 lines (39 loc) · 1.53 KB
/
.setupkeystore.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
keyring="$1"
set -x
if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ] && [ "$keyring" == "gnome" ]; then
killall kwalletd || true
export $(dbus-launch) # --config-file=${GITHUB_WORKSPACE}/.github/workflows/dbus.xml)
eval "$(echo '\n' | gnome-keyring-daemon --unlock)"
echo [email protected] | secret-tool store --label="main" email address
PASS=$(secret-tool lookup email address)
echo Checking the secret can be retrieved.
if [ "$PASS" != "[email protected]" ]; then
echo FAIL: the secret could not be retrieved.
exit 1;
fi
echo SUCCESS: the secret could be retrieved.
fi
if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ] && [ "$keyring" == "kde" ]; then
# install pre-filled wallet (because there is no way to interactively create key store without password)
# created with empty password
# entry added with `kwalletcli -f . -e address -p [email protected]`
killall gnome-keyring-daemon || true
mkdir -p ~/.local/share/kwalletd
cp $GITHUB_WORKSPACE/.setupkeystore/* ~/.local/share/kwalletd
chmod 600 ~/.local/share/kwalletd/*
dbus-uuidgen --ensure
export $(dbus-launch)
password=$(kwalletcli -f . -e address)
echo Checking the secret can be retrieved.
if [ "$password" != "[email protected]" ]; then
echo FAIL: the secret could not be retrieved.
exit 1;
fi
echo SUCCESS: the secret could be retrieved.
fi
if [ "$(uname -s)" == "Darwin" ]; then
ls -la ~/Library/Keychains/
#was need in travisci as these creds leaked between build boxes.
#rm -rf ~/Library/Keychains/login.keychain
fi