forked from openDsh/dash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.sh
executable file
·144 lines (133 loc) · 4.2 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
#!/bin/bash
#Help text
display_help() {
echo
echo " --aasdk uninstall aasdk"
echo " --openauto uninstall openauto "
echo " --gstreamer uninstall gstreamer "
echo " --dash uninstall dash "
echo " --h264bitstream uninstall h264bitstream"
echo " --pulseaudio uninstall pulseaudio"
echo " --bluez uninstall bluez"
echo " --ofono uninstall ofono"
echo " --all uninstall all components "
echo
}
script_path=$(dirname "$(realpath -s "$0")")
#check to see if there are any arguments supplied, if none are supplied run full install
if [ $# -gt 0 ]; then
#initialize all arguments to false before looping to find which are available
aasdk=false
gstreamer=false
openauto=false
dash=false
h264bitstream=false
pulseaudio=false
bluez=false
ofono=false
while [ "$1" != "" ]; do
case $1 in
--aasdk ) aasdk=true
;;
--gstreamer ) gstreamer=true
;;
--openauto ) openauto=true
;;
--dash ) dash=true
;;
--h264bitstream ) h264bitstream=true
;;
--pulseaudio ) pulseaudio=true
;;
--bluez ) bluez=true
;;
--ofono ) ofono=true
;;
-h | --help ) display_help
exit
;;
* ) display_help
exit 1
esac
shift
done
else
echo -e Full uninstall running'\n'
aasdk=true
gstreamer=true
openauto=true
dash=true
h264bitstream=true
pulseaudio=true
bluez=true
ofono=true
fi
if [ $pulseaudio = true ] && [ -d "$script_path/pulseaudio" ]; then
echo "Uninstalling pulseaudio"
cd pulseaudio
sudo make uninstall
cd ..
sudo rm -rv pulseaudio
rm uninstall
fi
if [ $ofono = true ] && [[ $(dpkg -l ofono 2> /dev/null) ]]; then
echo "Uninstalling ofono"
sudo apt purge -y ofono
echo "Removing pulse config enhancemnets"
sudo sed -i 's/load-module module-bluetooth-discover headset=ofono/load-module module-bluetooth-discover/g' /etc/pulse/default.pa
sudo sed -i '/### Echo cancel and noise reduction/,/.endif/d' /etc/pulse/default.pa
fi
if [ $bluez = true ] && [ -d "$script_path/bluez-5.63" ]; then
echo "Uninstalling bluez-5.63"
cd bluez-5.63
sudo make uninstall
cd ..
rm -rv bluez-5.63
fi
if [ $aasdk = true ] && [ -d "$script_path/aasdk/build" ]; then
echo "Removing aasdk"
cd aasdk/build
xargs sudo rm < install_manifest.txt
cd ../..
sudo rm -rv aasdk
fi
if [ $h264bitstream = true ] && [ -d "$script_path/h264bitstream" ]; then
echo "Uninstalling h264bitstream"
cd h264bitstream
sudo make uninstall
cd ..
sudo rm -rv h264bitstream
fi
if [ $gstreamer = true ] && [ -d "$script_path/qt-gstreamer/build" ]; then
echo "Uninstalling qt-gstreamer"
cd qt-gstreamer/build
sudo make uninstall
cd ../..
sudo rm -rv qt-gstreamer
fi
if [ $openauto = true ] && [ -d "$script_path/openauto/build" ]; then
echo "Removing openauto"
cd openauto/build
xargs sudo rm < install_manifest.txt
cd ../..
sudo rm -rv openauto
fi
if [ $dash = true ] && [ -d "$script_path/bin" ]; then
echo "Removing dash binary"
rm -rv bin build
if [ -f "$HOME/Desktop/dash.desktop" ]; then
echo "Removing desktop shortcut"
rm -v $HOME/Desktop/dash.desktop
fi
if [ -f "/etc/systemd/system/dash.service" ]; then
echo "Removing Systemd daemon"
sudo systemctl stop dash.service || true
sudo systemctl disable dash.service || true
sudo systemctl unmask dash.service || true
fi
if [ -f $HOME/run_dash.sh ]; then
echo "Removing xinit runner and bashrc line"
rm -v $HOME/run_dash.sh
sed -i '/### xinit/,/fi/d' $HOME/.bashrc
fi
fi