-
Notifications
You must be signed in to change notification settings - Fork 0
/
fluxboxstartup.sh
executable file
·184 lines (148 loc) · 4.48 KB
/
fluxboxstartup.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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/bin/bash
#color codes
RED='\033[1;31m'
YELLOW='\033[1;33m'
BLUE="\\033[38;5;27m"
SEA="\\033[38;5;49m"
GREEN='\033[1;32m'
CYAN='\033[1;36m'
WHITE="\\033[1;97m"
NC='\033[0m'
# function definitions
function setPermissions() {
device=$(nmcli -t con | cut -d ":" -f4)
sudo dhclient -v $device
sudo apt install ifupdown -y
sudo mv -f ~/flux-multitool/grub.config /etc/default/grub
sudo update-grub
chmod u+x ~/flux-multitool/resetnetwork.sh
chmod +x ~/flux-multitool/resetnetwork.sh
}
function showIntro() {
clear
cat ~/flux-multitool/fluxart.txt
sleep 2
clear
echo -e "${BLUE} ======================== WELCOME TO FLUXBOX V1.1 ======================="
echo -e "${CYAN} ======================== www.fluxnodestore.com =========================\r\n"
echo -e "FluxBox Name:\t$HOSTNAME"
echo -e "IP Address:\t$(hostname -I)"
echo -e "Public IP:\t$(dig +short myip.opendns.com @resolver1.opendns.com)"
echo -e "\n"
echo -e "${YELLOW} ======================= PROCESSOR INFORMATION ==========================${WHITE}"
lscpu | grep -E "Model name|^CPU\(s\):|Architecture:|Thread\(s\) per core"
echo -e "\r\n${YELLOW} ======================= MEMORY INFORMATION =============================${WHITE}"
cat /proc/meminfo | grep -E "MemTotal|MemFree|MemAvailable"
echo -e "\r\n${YELLOW} ======================= STORAGE INFORMATION ============================${WHITE}"
lsblk | grep -E "^.*disk"
echo -e "${WHITE}\n *** For Help and Support - DJ Mines Discord FLUX Node Channel or Flux Community Support ONLY ***"
echo -e "${WHITE} *** NOTE: Type ${CYAN}\"start\"${WHITE} from the command prompt to get back to this menu at any time ***\n"
}
function restartNic() {
service docker stop
sudo /etc/init.d/networking restart
service docker start
}
function installRestartCron() {
crontab -l > mycron.temp
echo "0 */2 * * * /home/fluxbox/flux-multitool/resetnetwork.sh" >> mycron.temp
crontab mycron.temp
rm mycron.temp
}
function showMenu() {
echo -e "${SEA} ========================= FLUX BOX MAIN MENU ===========================${WHITE}"
echo -e " 1. Launch FluxNode Setup"
echo -e " 2. Change Password"
echo -e " 3. Rename Box"
echo -e " 4. Restart FluxBox"
echo -e " 5. Setup Wifi"
echo -e " 6. Refresh Network Interface"
echo -e " 7. Install Automated Network Refresh Job"
echo -e "\n"
read -rp "Please select an option and hit ENTER: "
case "$REPLY" in
1)
clear
sleep 1
launchToolBox
exit 0
;;
2)
clear
sleep 1
passwd
;;
3)
clear
echo "Current Name: $HOSTNAME"
read -p "Enter new name : " newName
echo -e "Setting to $newName... Please wait a moment"
sudo hostnamectl set-hostname $newName
sleep 15
export HOSTNAME=$newName
hostnamectl | grep "Static hostname"
echo -e "\n Success, new name is $HOSTNAME"
sleep 3
;;
4)
read -p "Would you like to restart Y/N?" -n 1 -r
echo -e "${NC}"
if [[ $REPLY =~ ^[Yy]$ ]]
then
clear
echo "Restarting FluxBox in..."
for ((counter=10; counter > 0; counter--))
do
echo $counter
sleep 1
done
sudo shutdown -r now
fi
;;
5)
clear
sudo python3 ~/flux-multitool/easywifi.py
;;
6)
clear
echo "Refreshing Network Interface..."
service docker restart
;;
7)
clear
echo "Installing crontab restart schedule"
installRestartCron
esac
showIntro
showMenu
}
function launchToolBox() {
echo -e "\r\n${YELLOW} ============================= IMPORTANT ================================${WHITE}"
echo -e " Before you proceed, please ensure you have the following information from your Zelcore Wallet\n"
echo -e " ${BLUE}1. You have sent at least 1000 FLUX from your Zelcore FLUX Wallet to ITSELF (Receiving Address)"
echo -e " 2. Your Zelcore Id (Apps -> Zelcore ID -> Tap QR Code)"
echo -e " 3. Your FluxNode Identity Key"
echo -e " 4. Your FluxNode Collateral TX ID"
echo -e " 5. Your FluxNode Output Index"
echo -e " 6. Enable UpnP on Your Router so traffic can be re-directed on the proper port to your node"
echo -e "${NC}\n${WHITE}"
read -p "Would you like to continue Y/N? " -n 1 -r
echo -e "${NC}"
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Launching MultiToolBox, please wait...."
sleep 3
~/flux-multitool/multitoolbox.sh
else
showIntro
showMenu
fi
}
# Allow port 9090
sudo ufw allow 9090
# Set basic perimssions on scripts
setPermissions
# Start Process
showIntro
# Show Menu
showMenu