-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.sh
54 lines (48 loc) · 1.07 KB
/
common.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
48
49
50
51
52
53
54
if [ -z "$THINGYJP_HOME" ]; then
if [ -z "$HOME" ]; then
echo "THINGYJP_HOME and HOME are not set, check your environment" >&2
exit 1
fi
THINGYJP_HOME="$HOME/.thingyjp"
fi
if [ -z "$THINGYJP_SELFSERVICEURL" ]; then
THINGYJP_SELFSERVICEURL="http://selfservice.public.thingy.jp/wtf"
fi
THINGYJP_ROOTCERT=$THINGYJP_HOME/thingyjp_root.crt
EASYRSA=./easy-rsa/easyrsa3/easyrsa
EASYRSA_PKI_USER="$THINGYJP_HOME/pki_user"
EASYRSA_PKI_SERVER="$THINGYJP_HOME/pki_server"
EASYRSA_PKI_DEVICE="$THINGYJP_HOME/pki_device"
EASYRSA_PKI_TEST="$THINGYJP_HOME/pki_test"
LOGFILE="$THINGYJP_HOME/log"
source git.inc
source easyrsa.inc
init () {
if [ ! -d "$THINGYJP_HOME" ]; then
mkdir "$THINGYJP_HOME"
fi
}
checkdeps () {
set +e
which curl &> /dev/null
if [ "$?" -ne "0" ]; then
echo "install curl"
exit 1
fi
which uuidgen &> /dev/null
if [ "$?" -ne "0" ]; then
echo "install uuid-runtime"
exit 1
fi
which jq &> /dev/null
if [ "$?" -ne "0" ]; then
echo "install jq"
exit 1
fi
which jo &> /dev/null
if [ "$?" -ne "0" ]; then
echo "install jo"
exit 1
fi
set -e
}