source: acroread/trunk/fuentes/debian/acroread.prerm @ 20

Last change on this file since 20 was 20, checked in by mabarracus, 5 years ago

added acroread ported from trusty, this is unmodified version from other ppa

File size: 5.9 KB
Line 
1#!/bin/sh
2
3MkTempInternal()
4{
5    if [ "${mktemp_count+set}" != "set" ]; then
6        mktemp_count="0"
7    fi
8
9    mktemp_file="/tmp/acrobat.$$.${mktemp_count}"
10
11    while test -e "$mktemp_file"
12    do
13        mktemp_count="`expr $mktemp_count + 1`"
14        mktemp_file="/tmp/acrobat.$$.${mktemp_count}"
15    done
16
17    touch "$mktemp_file" && chmod 600 "$mktemp_file" && echo "$mktemp_file"
18}
19
20MkTemp()
21{
22    template="tmp.XXXXXXXXXX";
23    MKTEMP="`which mktemp 2>/dev/null`";
24    if [ "$MKTEMP" != "" ]; then
25            :
26    else
27            MKTEMP="MkTempInternal";
28    fi
29
30    $MKTEMP /tmp/acrobat.$template
31}
32
33
34remove()
35{
36    file="$@"
37
38    if [ -d "$file" ]; then
39        rmdir "$file"
40    else
41        rm -f "$file"
42    fi
43}
44
45
46uninstall_icon()
47{
48    PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-icon-resource uninstall "$@" >/dev/null 2>&1
49}
50
51
52uninstall_desktop_menu()
53{
54    PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-desktop-menu uninstall "$@" >/dev/null 2>&1
55}
56
57
58uninstall_desktop_icon()
59{
60    PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-desktop-icon uninstall "$@" >/dev/null 2>&1
61}
62
63
64uninstall_mime()
65{
66    PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-mime uninstall "$@" >/dev/null 2>&1
67}
68
69unset_mime()
70{
71    for i in application/pdf application/vnd.adobe.xfdf application/vnd.fdf application/vnd.adobe.xdp+xml application/vnd.adobe.pdx application/fdf application/xdp application/xfdf application/pdx; do
72        PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH:/usr/ucb" xdg-mime unset "$@" "${i}"
73    done
74}
75
76
77UnInstallIcons()
78{
79    install_dir="$1/Adobe/Reader9/Resource/Icons"
80
81    for icon_size in 16 22 24 32 48 64 128; do
82        uninstall_icon --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/AdobeReader9.png"
83        uninstall_icon --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/adobe.pdf.png"
84        uninstall_icon --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/adobe.pdf.png" 'application-pdf'
85        uninstall_icon --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.fdf.png"
86        uninstall_icon --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.fdf.png" 'application-fdf'
87        uninstall_icon --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.pdx.png"
88        uninstall_icon --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.pdx.png" 'application-pdx'
89        uninstall_icon --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xdp+xml.png"
90        uninstall_icon --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xdp+xml.png" 'application-xdp+xml'
91        uninstall_icon --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xfdf.png"
92        uninstall_icon --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xfdf.png" 'application-xfdf'
93    done
94}
95
96
97TrimSpaces()
98{
99    OLD_IFS_Trim_Spaces="$IFS"
100    IFS=' '
101    echo $@
102    IFS="$OLD_IFS_Trim_Spaces"
103}
104
105
106ProcessConfigFile()
107{
108    OLD_IFS_ProcessConfigFile="$IFS"
109    config_file="$1"
110
111    IFS=' '
112    cat "$config_file" | grep -v "^[ ]*#" | \
113    while read op args
114    do
115        op="`TrimSpaces $op`"
116
117        case "$op" in
118            remove | uninstall_icon | uninstall_desktop_menu | uninstall_mime)
119                "$op" $args 2>/dev/null ;;
120        esac
121    done
122
123    IFS="$OLD_IFS_ProcessConfigFile"
124}
125
126
127UnInstallReader()
128{
129    ReadInstallDir="$1"
130    config_file="$ReadInstallDir/Adobe/Reader9/Reader/GlobalPrefs/.config"
131    UnInstallIcons "$ReadInstallDir"
132    #uninstall_desktop_menu --novendor "$ReadInstallDir/Adobe/Reader9/Resource/Support/AdobeReader.desktop"
133    #uninstall_desktop_icon --novendor "$ReadInstallDir/Adobe/Reader9/Resource/Support/AdobeReader.desktop"
134    unset_mime "acroread.desktop"
135    if [ -e /usr/share/applications/evince.desktop ]; then
136        PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-mime default "evince.desktop" "application/pdf" >/dev/null 2>&1
137    fi
138
139
140    if [ -f "$config_file" ]; then
141        ProcessConfigFile "$config_file"
142        rm -f "$config_file"
143    fi
144
145    PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-icon-resource forceupdate >/dev/null 2>&1
146    #rm -f /usr/bin/acroread
147    #rm -f /usr/share/man/man1/acroread.1.gz
148    #rm -f /etc/bash_completion.d/acroread
149   
150    ## kill synchronizerapp
151    tmpfile="`MkTemp`"
152    ps -ef 2>/dev/null > "$tmpfile"
153   
154    synchronizerapp_pid="`awk '{ print $8, $2 }' < "$tmpfile" | grep -w "^$ReadInstallDir/Adobe/Reader9/Reader/intellinux/SynchronizerApp" | awk '{ print $NF; exit }'`"
155   
156    if [ -z "$synchronizerapp_pid" ]; then
157        ps auwwwxg 2>/dev/null > "$tmpfile"
158        synchronizerapp_pid="`awk '{ print $11, $2 }' < "$tmpfile" | grep -w "^$ReadInstallDir/Adobe/Reader9/Reader/intellinux/SynchronizerApp" | awk '{ print $NF; exit }'`"
159   
160        if [ -z "$synchronizerapp_pid" ]; then
161            rm -f "$tmpfile"
162            exit 0
163        fi
164    fi
165   
166    rm -f "$tmpfile"
167   
168    if [ -n "$synchronizerapp_pid" ]; then
169        kill -KILL "$synchronizerapp_pid"
170    fi
171}
172
173
174case "$1" in
175    purge|remove|upgrade)
176
177        if [ `lsb_release -a |grep Release |awk -F" " '{print $2}'` != "8.04" ]; then
178                if [ `uname -m | cut -c 1` != "i" ]; then
179                        nspluginwrapper -r /usr/lib/nspluginwrapper/plugins/npwrapper.nppdf.so
180                fi
181        fi
182
183        ReadInstallDir="/opt"
184        UnInstallReader "$ReadInstallDir" 2>/dev/null
185    ;;
186
187    failed-upgrade|abort-install|abort-upgrade|disappear)
188    ;;
189
190    *)
191        echo "postrm called with unknown argument \`$1'" >&2
192        exit 0
193esac
194
195#DEBHELPER#
Note: See TracBrowser for help on using the repository browser.