-
Notifications
You must be signed in to change notification settings - Fork 20
/
cli.sh
executable file
·58 lines (50 loc) · 1.13 KB
/
cli.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
55
56
57
58
#!/bin/bash
SCRIPTPATH=$(realpath "$0")
SCRIPTFOLDER=$(dirname "$SCRIPTPATH")
SCRIPTARGS="$*"
TEMPLATES="$SCRIPTFOLDER/templates"
SERVICES="$SCRIPTFOLDER/services"
MAGAZINES="$SCRIPTFOLDER/magazines"
CONFIGFILE=/etc/treehouses.conf
BASENAME=$(basename "$0")
WIFICOUNTRY="US"
LOGFILE=/dev/null
LOG=0
BLOCKER=0
token="$(echo YWRmYWI1NmIyZjEwYjg1Zjk0ZGIyNWYxOGU1MWE0YjQ2NWRiZDY3MAo= | openssl enc -d -pbkdf2 -a -salt -pass 'pass:I&l_v^diS%%repo')"
channel="https://api.gitter.im/v1/rooms/5ba5af3cd73408ce4fa8fcfb/chatMessages"
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
# set on ../templates/network/tor_report.sh
if [ ! -z "$gitter_channel" ]; then
channel="$gitter_channel"
fi
if [[ -f "$CONFIGFILE" ]]; then
source "$CONFIGFILE"
fi
if [[ "$LOG" == "max" ]]; then
set -x
exec 1> >(tee >(logger -t @treehouses/cli)) 2>&1
fi
for f in $SCRIPTFOLDER/modules/*.sh
do
source "$f"
cmd=${f##*/}
cmd=${cmd%.*}
if [ "$cmd" = "$1" ] && [ "$1" != "globals" ]; then
find=1
fi
done
if [ "$find" = 1 ]; then
start_spinner
"$@"
else
help
fi
if [ $? -eq 0 ]; then
logit "$SCRIPTARGS" "1"
fi
if [[ ! -v NOSPIN ]]; then
tput cvvis
fi