-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathMac_Uninstall_openMHA_Jack_pkg
157 lines (151 loc) · 6.38 KB
/
Mac_Uninstall_openMHA_Jack_pkg
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
#!/bin/bash
# This script uninstalls older versions of openMHA (up to version v4.17.0) and
# and Jack (its main dependency) that were installed using the pkg installer.
# It moves their files to the recycle bin and deregisters the packages.
# Move files to recycle bin instead of deleting them
TRASHDATE="$HOME/.Trash/$(date "+%Y-%m-%d-%H-%M-%S")"
move_to_recycle_bin() {
echo "Moving $1 to the recycle bin..."
mkdir -p "$TRASHDATE"/$(dirname "$1")
sudo /bin/mv -v "$1" "$TRASHDATE"/$(dirname "$1")
}
RM=move_to_recycle_bin
# User may permanently delete the files later by emptying the recycle bin
# Check if openMHA is installed from pkg installer
if pkgutil --pkgs | grep -q '^org.openmha.openMHA$'
then
echo "openMHA package found. Uninstalling..."
# Only the following three files are installed in common locations
for file in usr/local/bin/analysemhaplugin \
usr/local/bin/generatemhaplugindoc \
usr/local/bin/mha
do
if [ -f /$file ] && \
pkgutil --only-files --files org.openmha.openMHA | grep -q ^$file'$'
then
$RM /$file
fi
done
# The rest of the files are installed in openMHA-specific locations
for dir in usr/local/share/openmha \
usr/local/lib/openmha \
usr/local/doc/openmha
do
if [ -d /$dir ] && \
pkgutil --only-dirs --files org.openmha.openMHA | grep -q ^$dir'$'
then
$RM /$dir
fi
done
# Finally, forget the package
echo "Forgetting package org.openmha.openMHA..."
sudo pkgutil --forget org.openmha.openMHA
else
echo "openMHA package not found."
fi
# Check if Jack is installed from pkg installer
if pkgutil --pkgs | grep -q '^org.jackaudio.jack2$'
then
echo "Jack package found. Uninstalling..."
# Only the following two directories are specific to jack:
for dir in include/jack lib/jack
do
if [ -d /usr/local/$dir ] && \
pkgutil --only-dirs --files org.jackaudio.jack2 | grep -q ^$dir'$'
then
$RM /usr/local/$dir
fi
done
# The rest of jack's files are installed in common locations, delete them
# individually
for file in /usr/local/bin/jack_alias \
/usr/local/bin/jack_bufsize \
/usr/local/bin/jack_connect \
/usr/local/bin/jack_control_client \
/usr/local/bin/jack_cpu_load \
/usr/local/bin/jack_evmon \
/usr/local/bin/jack_freewheel \
/usr/local/bin/jack_impulse_grabber \
/usr/local/bin/jack_iodelay \
/usr/local/bin/jack_latent_client \
/usr/local/bin/jack_load \
/usr/local/bin/jack_load_test \
/usr/local/bin/jack_lsp \
/usr/local/bin/jack_metro \
/usr/local/bin/jack_midi_dump \
/usr/local/bin/jack_midi_latency_test \
/usr/local/bin/jack_midiseq \
/usr/local/bin/jack_midisine \
/usr/local/bin/jack_monitor_client \
/usr/local/bin/jack_net_master \
/usr/local/bin/jack_net_slave \
/usr/local/bin/jack_netsource \
/usr/local/bin/jack_property \
/usr/local/bin/jack_rec \
/usr/local/bin/jack_samplerate \
/usr/local/bin/jack_server_control \
/usr/local/bin/jack_showtime \
/usr/local/bin/jack_simdtests \
/usr/local/bin/jack_simple_client \
/usr/local/bin/jack_thru_client \
/usr/local/bin/jack_transport \
/usr/local/bin/jack_transport_client \
/usr/local/bin/jack_tw \
/usr/local/bin/jack_unload \
/usr/local/bin/jack_wait \
/usr/local/bin/jack_zombie \
/usr/local/bin/jackd \
/usr/local/lib/libjack.*dylib \
/usr/local/lib/libjacknet.*dylib \
/usr/local/lib/libjackserver.*dylib \
/usr/local/lib/pkgconfig/jack.pc \
/usr/local/share/man/man1/jack_bufsize.1 \
/usr/local/share/man/man1/jack_connect.1 \
/usr/local/share/man/man1/jack_disconnect.1 \
/usr/local/share/man/man1/jack_freewheel.1 \
/usr/local/share/man/man1/jack_impulse_grabber.1 \
/usr/local/share/man/man1/jack_iodelay.1 \
/usr/local/share/man/man1/jack_load.1 \
/usr/local/share/man/man1/jack_lsp.1 \
/usr/local/share/man/man1/jack_metro.1 \
/usr/local/share/man/man1/jack_monitor_client.1 \
/usr/local/share/man/man1/jack_netsource.1 \
/usr/local/share/man/man1/jack_property.1 \
/usr/local/share/man/man1/jack_rec.1 \
/usr/local/share/man/man1/jack_samplerate.1 \
/usr/local/share/man/man1/jack_showtime.1 \
/usr/local/share/man/man1/jack_simple_client.1 \
/usr/local/share/man/man1/jack_transport.1 \
/usr/local/share/man/man1/jack_unload.1 \
/usr/local/share/man/man1/jack_wait.1
do
file_without_usr_local="${file#/usr/local/}"
# If the file is a symlink and its name begins with /usr/local/lib/libjack
if [ -L "$file" ] && [[ "$file" == "/usr/local/lib/libjack"* ]]
then
# Check if the symlink points to a file from the jack package
if pkgutil --only-files --files org.jackaudio.jack2 | grep -q "^lib/$(readlink "$file")"'$'
then
echo "Removing symlink $file pointing to /usr/local/lib/$(readlink "$file")" ...
$RM "$file"
fi
fi
if [ -f "$file" ] && \
pkgutil --only-files --files org.jackaudio.jack2 | grep -q "^$file_without_usr_local"'$'
then
$RM "$file"
fi
done
# Finally, forget the package
echo "Forgetting package org.jackaudio.jack2..."
sudo pkgutil --forget org.jackaudio.jack2
else
echo "Jack package not found."
fi
echo
# Check if QJackCtl is installed as app bundle
if [ -d /Applications/QjackCtl.app ] || [ -d ~/Applications/QjackCtl.app ]
then
echo "You have QJackCtl.app installed. Please uninstall by dragging the "
echo "app from the Applications folder to the recycle bin."
fi