-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
51 lines (41 loc) · 1.63 KB
/
setup.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
#!/bin/bash
###################
# variables #
###################
# sh folders
upgrade="dorna_python dorna_lab example wizard server firmware"
# current dir
current_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
######################
# check the OS #
######################
# Get the version number from /etc/os-release
version=$(grep -oP '(?<=VERSION_ID=").*(?=")' /etc/os-release)
# Compare the version number
if dpkg --compare-versions "$version" lt 11; then
echo "##################################################################################################################"
echo "# The Robot Operating System (OS) is outdated. #"
echo "# Before proceeding, please upgrade your robot controller OS to the latest version (version 11 or higher). #"
echo "##################################################################################################################"
exit 1
fi
# install the requirements
pip3 install -r $current_dir/requirements.txt
for val in $upgrade; do
cd $current_dir/$val
sh setup.sh $1
done
# remove the directory
rm -rf $current_dir
# sleep for 60 seconds
echo "Cleaning the buffer..."
sleep 30
# shutdown
echo "#######################################################"
echo "# Setup process is now finished. #"
echo "# To finalize the update, follow the steps below: #"
echo "# 1. Wait for 30 seconds. #"
echo "# 2. Power cycle the controller. #"
echo "#######################################################"
# reboot
reboot