-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathuninstall.sh
executable file
·265 lines (226 loc) · 6.71 KB
/
uninstall.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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#!/bin/bash
format='\e[93m\e[1m\e[4m'
yellow='\e[93m'
cyan='\e[96m'
bold='\e[1m'
clearformat='\e[0m'
underline='\e[4m'
CATKIN=~/catkin_ws/
ntoinstall=0
# clear
echo -e "\e[?1049h"
display_center(){
columns="$(tput cols)"
while IFS= read -r line; do
printf "%*s\n" $(( (${#line} + columns) / 2)) "$line"
done < "$1"
}
prog() {
exec < /dev/tty
oldstty=$(stty -g)
stty raw -echo min 0
# on my system, the following line can be replaced by the line below it
echo -en "\033[6n" > /dev/tty
# tput u7 > /dev/tty # when TERM=xterm (and relatives)
IFS=';' read -r -d R -a pos
stty $oldstty
# change from one-based to zero based so they work with: tput cup $row $col
row=$((${pos[0]:2} - 1)) # strip off the esc-[
col=$((${pos[1]} - 1))
tput cup $(tput lines) 0
local w=80 p=$1; shift
# create a string of spaces, then change them to dots
printf -v dots "%*s" "$(( $p*$w/100 ))" ""; dots=${dots// /.};
# print those dots on a fixed-width space plus the percentage etc.
printf "\r\e[K|%-*s| %3d %% %s" "$w" "$dots" "$p" "$*";
row=$(($row + 1))
echo "\033[${row};${col}H"
}
# IFS=$'\n'
# for word in $(< logo.txt)
# do
# print_center $word
# done
display_center "logo.txt"
# ./prog.sh &
echo ""
echo ""
echo -e "${bold}Sun Devil Robotics Club urc-code Dependencies Installer${clearformat}"
echo ""
echo This script will This script will uninstall dependencies needed to successfully run the sdrc_urc ROS package!
echo ""
echo You are on ROS $ROS_DISTRO.
echo -e "${format}Do you wish to uninstall the following dependencies:${clearformat}"
while IFS=, read -r src name
do
wd=$(pwd)
cd ..
if [ -d "./$name" ]; then
echo -e "${yellow}$name${clearformat},"
fi
cd $wd
done < packages_to_uninstall.csv
read -p 'y/n: ' cont
case $cont in
y|Y) cont=True ;;
n|N) cont=False ;;
*) cont=False ;;
esac
if [ $cont == "False" ]; then
echo "Exiting."
echo -e "\e[?1049l"
exit 0
fi
echo ""
echo -e "${cyan}${underline}Uninstalling dependencies.${clearformat}"
while IFS=, read -r src name
do
if [ $src == "apt" ]; then
echo "sudo apt remove $name"
else
wd=$(pwd)
cd ..
if [ -d "./$name" ]; then
echo -e "Uninstalling ${yellow}$name${clearformat}"
rm -r ./$name
fi
cd $wd
fi
done < packages_to_uninstall.csv
rm ./packages_to_uninstall.csv
echo ""
echo "Successfully installed dependencies installed from source. You may now uninstall any dependencies installed with apt."
read -n 1 -s -r -p "Press any key to continue"
# clear
echo -e "\e[?1049l"
# echo This script will install dependencies needed to successfully run
# echo SDRC software with ROS.
# echo
# echo -e "\e[93m\e[1m\e[4mDo you wish to install the following dependencies:\e[0m"
# if [ ! -d "$CATKIN/src/roboteq" ]; then
# printf "\troboteq_driver\n"
# let "ntoinstall++"
# fi
# if [ ! -d "$CATKIN/src/serial" ]; then
# printf "\tserial\n"
# let "ntoinstall++"
# fi
# #printf "\n\tar_track_alvar"
# if [ ! -d "$CATKIN/src/joystick_drivers" ]; then
# printf "\tjoy\n"
# let "ntoinstall++"
# fi
# if ! dpkg -l | grep -qw libspnav-dev; then
# printf "\tlibspnav-dev\n"
# let "ntoinstall++"
# fi
# if ! dpkg -l | grep -qw libbluetooth-dev; then
# printf "\tlibbluetooth-dev\n"
# let "ntoinstall++"
# fi
# if ! dpkg -l | grep -qw libcwiid-dev; then
# printf "\tlibcwiid-dev\n"
# let "ntoinstall++"
# fi
# if ! dpkg -l | grep -qw libusb-dev; then
# printf "\tlibusb-dev\n"
# let "ntoinstall++"
# fi
# if ! dpkg -l | grep -qw ros-melodic-diagnostics; then
# printf "\tros-melodic-diagnostics\n"
# let "ntoinstall++"
# fi
# if ! dpkg -l | grep -qw ros-melodic-roslint; then
# printf "\tros-melodic-roslint\n"
# let "ntoinstall++"
# fi
# if ! dpkg -l | grep -qw ros-melodic-turtlesim; then
# printf "\tros-melodic-turtlesim\n"
# let "ntoinstall++"
# fi
# if ! dpkg -l | grep -qw libx11-dev; then
# printf "\tlibx11-dev\n"
# let "ntoinstall++"
# fi
# if [ $ntoinstall == 0 ]; then
# echo -e "\e[1m\nYou are all up to date! Exiting..."
# exit 0
# fi
# if [ $# -eq 0 ]; then
# read -p 'y/n: ' continue
# fi
# if [ $1 = "-f" ] || ping -q -c 1 -W 1 8.8.8.8 >/dev/null; then
# if [ $1 = "-f" ] || [ $continue = "y" ] || [ $continue = "Y" ] || [ $continue = "yes" ] || [ $continue = "Yes" ]
# then
# echo -e "\e[93m\e[4mUpdating repository:\e[0m"
# echo apt-get update
# sudo apt-get update
# echo
# if [ ! -d "$CATKIN/src" ]; then
# echo "\n\e[93m\e[1mERROR: Cannot locate catkin workspace!"
# echo "Make sure it is set up at $CATKIN"
# exit 1
# fi
# # if [ ! -d "$CATKIN/src/roboteq" ]; then
# # echo -e "\e[93m\e[4mInstalling roboteq_driver:\e[0m"
# # cd $CATKIN/src/
# # git clone https://github.com/g/roboteq.git
# # echo
# # fi
# if [ ! -d "$CATKIN/src/serial" ]; then
# echo -e "\e[93m\e[4mInstalling serial:\e[0m"
# cd $CATKIN/src/
# git clone https://github.com/wjwwood/serial.git
# cd serial
# make
# echo
# fi
# if [ ! -d "$CATKIN/src/joystick_drivers" ]; then
# echo -e "\e[93m\e[4mInstalling joy:\e[0m"
# cd $CATKIN/src/
# git clone https://github.com/ros-drivers/joystick_drivers.git
# echo
# fi
# echo -e "\e[93m\e[4mInstalling libspnav-dev:\e[0m"
# echo apt install -y libspnav-dev
# sudo apt install -y libspnav-dev
# echo
# echo -e "\e[93m\e[4mInstalling libbluetooth-dev:\e[0m"
# echo apt install -y libbluetooth-dev
# sudo apt install -y libbluetooth-dev
# echo
# echo -e "\e[93m\e[4mInstalling libcwiid-dev:\e[0m"
# echo apt install -y libcwiid-dev
# sudo apt install -y libcwiid-dev
# echo
# echo -e "\e[93m\e[4mInstalling libusb-dev:\e[0m"
# echo apt install -y libusb-dev
# sudo apt install -y libusb-dev
# echo
# echo -e "\e[93m\e[4mInstalling ros-melodic-diagnostics:\e[0m"
# echo apt install -y ros-melodic-diagnostics
# sudo apt install -y ros-melodic-diagnostics
# echo
# echo -e "\e[93m\e[4mInstalling ros-melodic-roslint:\e[0m"
# echo apt install -y ros-melodic-roslint
# sudo apt install -y ros-melodic-roslint
# echo
# echo -e "\e[93m\e[4mInstalling ros-melodic-turtlesim:\e[0m"
# echo apt install -y ros-melodic-turtlesim
# sudo apt install -y ros-melodic-turtlesim
# echo
# echo -e "\e[93m\e[4mInstalling libx11-dev:\e[0m"
# echo apt install -y libx11-dev
# sudo apt install -y libx11-dev
# echo
# echo -e "\e[93m\e[4mRunning catkin_make:\e[0m"
# echo cd $CATKIN
# cd $CATKIN
# echo catkin_make
# catkin_make
# echo
# echo Successfully installed all dependencies!
# fi
# else
# echo -e "\n\e[93m\e[1mERROR! Please check your internet connection and try again!"
# fi