forked from HHgzs/TJURM-2024
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·119 lines (94 loc) · 2.48 KB
/
run.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
#!/bin/bash
blue="\033[1;34m"
yellow="\033[1;33m"
reset="\033[0m"
include_count=$(find include -type f \( -name "*.cpp" -o -name "*.h" \) -exec cat {} \; | wc -l)
src_count=$(find src -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.txt" \) -exec cat {} \; | wc -l)
total=$((include_count + src_count))
if [ ! -d "data/debug" ]; then
mkdir data/debug
touch data/debug/here_save_debug_images
fi
if [ ! -d "data/video" ]; then
mkdir data/video
touch data/video/here_save_video
fi
if [ ! -d "data/speed" ]; then
mkdir data/speed
touch data/speed/here_save_shoot_speed
fi
if [ ! -d "/etc/openrm" ]; then
mkdir /etc/openrm
sudo cp -r data/uniconfig/* /etc/openrm/
sudo chmod -R 777 /etc/openrm
fi
if [ ! -d "config" ]; then
ln -s /etc/openrm ./config
fi
if [ ! -d "build" ]; then
mkdir build
fi
imshow=0
while getopts ":rcg:ls" opt; do
case $opt in
r)
echo -e "${yellow}<--- delete 'build' --->\n${reset}"
sudo rm -rf build
mkdir build
shift
;;
c)
sudo cp -r data/uniconfig/* /etc/openrm/
sudo chmod -R 777 /etc/openrm
exit 0
shift
;;
g)
git_message=$OPTARG
echo -e "${yellow}\n<--- Git $git_message --->${reset}"
git pull
git add -A
git commit -m "$git_message"
git push
exit 0
shift
;;
l)
cd ../OpenRM
sudo ./run.sh
cd ../TJURM-2024
exit 0
shift
;;
s)
imshow=1
shift
;;
\?)
echo -e "${red}\n--- Unavailable param: -$OPTARG ---\n${reset}"
;;
:)
echo -e "${red}\n--- param -$OPTARG need a value ---\n${reset}"
;;
esac
done
echo -e "${yellow}<--- Start CMake --->${reset}"
cd build
cmake ..
echo -e "${yellow}\n<--- Start Make --->${reset}"
max_threads=$(cat /proc/cpuinfo | grep "processor" | wc -l)
make -j "$max_threads"
echo -e "${yellow}\n<--- Total Lines --->${reset}"
echo -e "${blue} $total${reset}"
echo -e "${yellow}\n<--- Run Code --->${reset}"
sudo rm /usr/local/bin/TJURM-2024
sudo cp TJURM-2024 /usr/local/bin/
sudo pkill TJURM-2024
sudo chmod 777 /dev/tty*
if [ $imshow = 1 ]; then
TJURM-2024 -s
else
TJURM-2024
fi
/etc/openrm/guard.sh
echo -e "${yellow}<----- OVER ----->${reset}"