-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup
executable file
·105 lines (88 loc) · 2.67 KB
/
setup
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
#Filename: Node Installer
#Author: soC
#Date: 01.08.18
#PATH=$PATH:scripts/
#export PATH
#chmod +x scripts/install && chmod +x scripts/install2 && chmod +x scripts/status
set -e
# Use provided repository or default to AtlMesh/atl-cjdns-pi
if [ -z "$GIT_ATL_CJDNS_PI" ]; then
GIT_ATL_CJDNS_PI="https://github.com/AtlMesh/atl-cjdns-pi.git"
fi
# Use provided tag or default to master
if [ -z "$TAG_ATL_CJDNS_PI" ]; then
TAG_ATL_CJDNS_PI=master
fi
if ! [ -z "`ps xa | awk '{print $5}' | grep dpkg | grep -v grep`" ]; then
echo -e "\e[1;31mDPKG is running in the background.\e[0m"
read -p "Would you like to KILL it to continue (Y/n)? " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Nn]$ ]]; then
echo -e "\e[1;31mPlease stop DPKG Before Proceeding!\e[0m"
exit
else
echo -e "\e[1;32mKilling DPKG and continuing\e[0m"
sudo killall dpkg
fi
fi
# Get git
sudo apt-get update
if ! [ "$(which git)" ]; then
sudo apt-get install git -y
fi
# Download atl-cjdns-pi repo
if ! [ -d "atl-cjdns-pi" ]; then
git clone $GIT_ATL_CJDNS_PI
fi
cd atl-cjdns-pi/scripts
git checkout $TAG_ATL_CJDNS_PI
# Export environment variables
export WITH_MESH_POINT
export WITH_WIFI_AP
export WITH_IPFS
export WITH_PROMETHEUS_NODE_EXPORTER
export WITH_PROMETHEUS_SERVER
export WITH_GRAFANA
export WITH_EXTRA_TOOLS
chmod +x install2
clear
#Main menu is called to screen
echo " _ _ __ __ _ _ _ _ "
echo " /\ | | | | | \/ | | | | \ | | | | "
echo " / \ | |_| | | \ / | ___ ___| |__ | \| | ___| |_ "
echo " / /\ \| __| | | |\/| |/ _ \/ __| '_ \ | |/ _ \ __|"
echo " / ____ \ |_| | | | | | __/\__ \ | | | | |\ | __/ |_ "
echo " /_/ \_\__|_| |_| |_|\___||___/_| |_| |_| \_|\___|\__|"
printf "\n"
printf "Node Installer\n"
printf "\n"
printf "1. Basic Install\n"
printf "2. Install with all optional features\n"
printf "3. Exit\n\n"
#user asked to choose from the options above
read -p "::> " menuoption
#will loop until a valid option is entered
until [ $menuoption -ge 1 ] && [ $menuoption -le 3 ];
do
echo "Invalid number entered"
read -p "Enter a number: " menuoption
done
# read the menuoption and call the corresponding case below
case $menuoption in
#clear the screen and call the method to do basic install
1)
clear
./install2
;;
#clear the screen and call the method to do install with all optional features
2)
clear
WITH_MESH_POINT=true WITH_WIFI_AP=true WITH_IPFS=true WITH_PROMETHEUS_NODE_EXPORTER=true WITH_PROMETHEUS_SERVER=true WITH_GRAFANA=true WITH_H_DNS=true WITH_H_NTP=true WITH_FAKE_HWCLOCK=true WITH_EXTRA_TOOLS=true ./install2
;;
#exit the application
3)
clear
exit
;;
esac