forked from HKEOS/Ghostbusters-Testnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publishPeerInfo.sh
47 lines (34 loc) · 1.18 KB
/
publishPeerInfo.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
45
46
47
#!/bin/bash
GLOBAL_PATH=$(pwd)
if [[ $1 == "" ]]; then
echo
echo -e "ERROR:\nPlease provide the input peer_info file!";
echo
exit 1;
fi
if ! which keybase > /dev/null; then
echo -e "Keybase not installed. Exiting..."
exit 1;
fi
## Check KBFS mount point
echo
echo "--------------- VERIFYING KEYBASE FILE SYSTEM ---------------";
echo
KBFS_MOUNT=$(keybase status | grep mount | cut -f 2 -d: | sed -e 's/^\s*//' -e '/^$/d');
## Restart Keybase if needed
if [ ! -d "$KBFS_MOUNT" ]; then
echo "KBFS is not running!";
run_keybase
sleep 3
else
echo "KBFS mount point: $KBFS_MOUNT";
echo
fi
keybaseUser=$(keybase status | grep Username: | cut -f2- -d: | sed -e 's/^\s*//' -e '/^$/d');
echo "Keybase user = $keybaseUser";
echo "Signing config file...";
keybase sign -i "$1" --saltpack-version 2 -o $KBFS_MOUNT/team/eos_ghostbusters/mesh/$keybaseUser.peer_info.signed
echo "Done. File saved at $KBFS_MOUNT/team/eos_ghostbusters/mesh/$keybaseUser.peer_info.signed";
echo -e "\n\n ---- BEGIN SIGNED FILE ---- \n";
cat $KBFS_MOUNT/team/eos_ghostbusters/mesh/$keybaseUser.peer_info.signed;
echo -e "\n ---- END SIGNED FILE ----";