-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathget_iplayer_uninstall
executable file
·92 lines (92 loc) · 2.12 KB
/
get_iplayer_uninstall
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
#!/bin/bash
sudo="sudo"
dstpath=/
if [[ -z $PACKAGE_PATH ]]
then
pkgname=$(basename "$0")
else
sudo=""
pkgname=$(basename "$PACKAGE_PATH" .pkg)
env | xargs -n1 echo $pkgname:
dstpath=$(echo $DSTVOLUME$DSTROOT | sed -E -e 's!^/+!/!')
echo $pkgname: dstpath=$dstpath
fi
rc=0
identifier=com.github.get-iplayer.getiplayer
uninstaller=${dstpath}usr/local/bin/get_iplayer_uninstall
items="
${dstpath}Applications/get_iplayer
${dstpath}usr/local/get_iplayer
${dstpath}usr/local/share/man/man1/get_iplayer.1
${dstpath}usr/local/bin/get_iplayer
${dstpath}usr/local/bin/get_iplayer.cgi
${dstpath}usr/local/bin/get_iplayer_cgi
${dstpath}usr/local/bin/get_iplayer_pvr
${dstpath}usr/local/bin/get_iplayer_web_pvr
"
for item in $items
do
if [[ -d $item ]]
then
$sudo rm -r "$item"
if [[ $? -ne 0 ]]
then
rc=1
echo $pkgname: could not remove directory: $item
else
echo $pkgname: removed directory: $item
fi
elif [[ -f $item ]]
then
$sudo rm "$item"
if [[ $? -ne 0 ]]
then
rc=1
echo $pkgname: could not remove file: $item
else
echo $pkgname: removed file: $item
fi
fi
done
lsr="/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister"
if [[ -x $lsr ]]
then
qur="${dstpath}Applications/get_iplayer/Quick URL Record.app"
out=$("$lsr" -u -v "$qur" 2>&1)
if [[ $out =~ unregistered ]]
then
echo $pkgname: unregistered from Launch Services: $qur
fi
fi
if [[ $rc -ne 0 ]]
then
echo $pkgname: some items could not be removed
echo $pkgname: retained uninstaller: $uninstaller
else
if [[ -f $uninstaller ]]
then
$sudo rm $uninstaller
if [[ $? -ne 0 ]]
then
echo $pkgname: could not remove uninstaller: $uninstaller
else
echo $pkgname: removed uninstaller: $uninstaller
fi
fi
if [[ -z $PACKAGE_PATH ]]
then
$sudo pkgutil --pkg-info $identifier > /dev/null 2>&1
if [[ $? -eq 0 ]]
then
$sudo pkgutil --forget $identifier > /dev/null 2>&1
if [[ $? -ne 0 ]]
then
echo $pkgname: could not remove receipt: $identifier
else
echo $pkgname: removed receipt: $identifier
fi
fi
fi
fi
echo "$pkgname: finished"
exit 0