-
Notifications
You must be signed in to change notification settings - Fork 14
/
deploy_bot.sh
executable file
·67 lines (51 loc) · 1.35 KB
/
deploy_bot.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
#!/bin/bash
# ONLY WORKS ON LINUX MACHINES WITH NMCLI
# variables here can be altered
NAME=852_testBot
LOCAL=TASGUEST
LOCAL_KEY=2100owlDiablo
# don't change stuff below here unless you know what you are doing please
RED='\033[0;31m'
GREEN='\033[0;42m'
NC='\033[0;m'
m_reset=0
if [[ $EUID -eq 0 ]]; then
echo -e "${RED}RESETTING WIFI INTERFACES${NC}"
m_reset=1
fi
if [[ m_reset -ne 0 ]]; then
ifconfig wlo1 down
ifconfig wlo1 up
fi
echo -e "Establishing connection to 852_testBot"
nmcli device wifi connect ${NAME}
if [[ "$?" != "0" ]]; then
echo -e "${RED}Could not find network ${NAME}, exiting...${NC}"
exit 1
fi
echo -e "${GREEN}Connection Established${NC}"
echo -e "Building robot code..."
./gradlew build
if [[ "$?" != "0" ]]; then
echo -e "${RED}Build failed, exiting...${NC}"
exit 1
fi
echo -e "${GREEN}Robot code built${NC}"
echo -e "Deploying robot code..."
./gradlew deploy
if [[ "$?" != "0" ]]; then
echo -e "${RED}Could not deploy robot code! Exiting...${NC}"
exit 1
fi
echo -e "Robot code deployed"
if [[ m_reset -ne 0 ]]; then
ifconfig wlo1 down
ifconfig wlo1 up
fi
echo -e "Connecting back to ${LOCAL}"
nmcli device wifi connect ${LOCAL} password ${LOCAL_KEY}
if [[ "$?" != "0" ]]; then
echo -e "${RED}Could not find network ${LOCAL}, exiting...${NC}"
exit 1
fi
echo -e "${GREEN}Success!${NC}"