source: acroread/trunk/fuentes/debian/acroread.postinst @ 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: 7.9 KB
Line 
1#!/bin/sh
2
3
4Which()
5{
6    OLD_IFS="$IFS"
7    IFS=':'
8
9    if [ -z "$1" ]; then
10        return 1
11    fi
12
13    for x in $PATH
14    do
15        if [ -x "$x/$1" ]; then
16            echo "$x/$1"
17            IFS="$OLD_IFS"
18            return 0
19        fi
20    done
21
22    IFS="$OLD_IFS"
23    return 1
24}
25
26
27record_config()
28{
29    config_file="$ReadInstallDir/Adobe/Reader9/Reader/GlobalPrefs/.config"
30    echo "$@" >> "$config_file"
31}
32
33
34install_icon()
35{
36    PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-icon-resource install "$@" >/dev/null 2>&1
37}
38
39
40install_desktop_menu()
41{
42    PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-desktop-menu uninstall --mode system "$@" >/dev/null 2>&1
43    PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-desktop-menu uninstall --mode user "$@" >/dev/null 2>&1
44    PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-desktop-menu install "$@" >/dev/null 2>&1
45}
46
47
48install_desktop_icon()
49{
50    eval desktop_file="\$$#"
51    PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-desktop-icon uninstall "$@" >/dev/null 2>&1
52    PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-desktop-icon install "$@" >/dev/null 2>&1 && chmod 777 "$HOME/Desktop/`basename "$desktop_file"`" 2>/dev/null
53}
54
55
56install_mime()
57{
58    PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-mime install "$@" >/dev/null 2>&1
59}
60
61
62InstallIcons()
63{
64    install_dir="$1/Adobe/Reader9/Resource/Icons"
65
66    for icon_size in 16 20 22 24 32 36 48 64 96 128 192; do
67        install_icon --noupdate --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/AdobeReader9.png"
68        install_icon --noupdate --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/adobe.pdf.png"
69        install_icon --noupdate --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/adobe.pdf.png" 'application-pdf'
70        install_icon --noupdate --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.fdf.png"
71        install_icon --noupdate --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.fdf.png" 'application-fdf'
72        install_icon --noupdate --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.pdx.png"
73        install_icon --noupdate --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.pdx.png" 'application-pdx'
74        install_icon --noupdate --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xdp+xml.png"
75        install_icon --noupdate --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xdp+xml.png" 'application-xdp+xml'
76        install_icon --noupdate --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xfdf.png"
77        install_icon --noupdate --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xfdf.png" 'application-xfdf'
78    done
79}
80
81MakeLibLDAPLinks()
82{
83    install_dir="$1/Adobe/Reader9/Reader"
84
85    rm -f "$install_dir/intellinux/lib/libldap.so"
86    if [ ! -e /usr/lib/libldap.so ]
87    then
88        LIB_LDAP="`ls -tr /usr/lib/libldap.so*  2>/dev/null | tail -n 1`"
89
90        if [ "$LIB_LDAP" = "" ] 
91            then
92                    LIB_LDAP="`ls -tr /usr/lib/libldap* 2>/dev/null | grep -v libldap_r | grep -v libldapcpp | grep '\.so' | tail -n 1`"
93        fi
94
95            if [ "$LIB_LDAP" != "" ] 
96        then
97                ln -s "$LIB_LDAP" "$install_dir/intellinux/lib/libldap.so"
98            fi
99    fi
100
101    rm -f "$install_dir/intellinux/lib/liblber.so"
102    if [ ! -e /usr/lib/liblber.so ]
103    then
104        LIB_LBER="`ls -tr /usr/lib/liblber.so* 2>/dev/null | tail -n 1`"
105
106        if [ "$LIB_LBER" = "" ] 
107        then
108                LIB_LBER="`ls -tr /usr/lib/liblber* 2>/dev/null | grep -v liblber_r | grep '\.so' | tail -n 1`"
109        fi
110
111        if [ "$LIB_LBER" != "" ] 
112            then
113                ln -s "$LIB_LBER" "$install_dir/intellinux/lib/liblber.so"
114            fi
115    fi
116}
117
118
119MakeLibGnomeSpeechLinks()
120{
121    install_dir="$1/Adobe/Reader9/Reader"
122    configured_dir="$2"
123    lib_dir="$install_dir/$configured_dir/lib"
124
125    if TESTSPEECHEXEC="`which test-speech`" && which ldd >/dev/null && which awk >/dev/null; then
126        rm -f "$lib_dir/libORBit-2.so" 2>/dev/null
127        rm -f "$lib_dir/libbonobo-2.so" 2>/dev/null
128        rm -f "$lib_dir/libbonobo-activation.so" 2>/dev/null
129        rm -f "$lib_dir/libgnomespeech.so" 2>/dev/null
130
131        lib_orbit2="`ldd $TESTSPEECHEXEC 2>/dev/null | grep -i libORBit-2.* | cut -d '>' -f2 | cut -d '(' -f 1 |awk '{print $1}' `"
132        lib_bonobo="`ldd $TESTSPEECHEXEC 2>/dev/null | grep -i bonobo-2.* | cut -d '>' -f2 | cut -d '(' -f 1 |awk '{print $1}' `"
133        lib_bonoboactivation="`ldd $TESTSPEECHEXEC 2>/dev/null | grep -i bonobo-activation.* | cut -d '>' -f2 | cut -d '(' -f 1 |awk '{print $1}' `"
134        lib_gnomespeech="`ldd $TESTSPEECHEXEC 2>/dev/null | grep -i libgnomespeech.* | cut -d '>' -f2 | cut -d '(' -f 1 |awk '{print $1}' `"
135
136        if [ -f "$lib_orbit2" -a -f "$lib_bonobo" -a -f "$lib_bonoboactivation" -a -f "$lib_gnomespeech" ]; then
137            ln -s "$lib_orbit2" "$lib_dir/libORBit-2.so" && record_config remove "$lib_dir/libORBit-2.so"
138            ln -s "$lib_bonobo" "$lib_dir/libbonobo-2.so" && record_config remove "$lib_dir/libbonobo-2.so"
139            ln -s "$lib_bonoboactivation" "$lib_dir/libbonobo-activation.so" && record_config remove "$lib_dir/libbonobo-activation.so"
140            ln -s "$lib_gnomespeech" "$lib_dir/libgnomespeech.so" && record_config remove "$lib_dir/libgnomespeech.so"
141        fi
142    fi
143}
144
145case "$1" in
146    configure)
147        ReadInstallDir="/opt"
148        MakeLibGnomeSpeechLinks "$ReadInstallDir" intellinux 2>/dev/null
149        MakeLibLDAPLinks "$ReadInstallDir" 2>/dev/null
150
151        #rm -f /usr/bin/acroread 2>/dev/null
152        #ln -s "$ReadInstallDir/Adobe/Reader9/bin/acroread" /usr/bin/acroread 2>/dev/null
153
154        #rm -f /etc/bash_completion.d/acroread.sh 2>/dev/null
155        #ln -s "$ReadInstallDir/Adobe/Reader9/Resource/Shell/acroread_tab" /etc/bash_completion.d/acroread.sh 2>/dev/null
156
157        #rm -f /usr/share/man/man1/acroread.1.gz 2>/dev/null
158        #ln -s "$ReadInstallDir/Adobe/Reader9/Resource/Shell/acroread.1.gz" /usr/share/man/man1/acroread.1.gz 2>/dev/null
159
160        InstallIcons "$ReadInstallDir"
161        #Canonical does not want us to associate MIME types because they say they do it themselves.
162        #install_mime --novendor "$ReadInstallDir/Adobe/Reader9/Resource/Support/AdobeReader.xml"
163
164        #install_desktop_menu --novendor "$ReadInstallDir/Adobe/Reader9/Resource/Support/AdobeReader.desktop"
165        #Canonical does not want a Desktop icon.
166        #install_desktop_icon --novendor "$ReadInstallDir/Adobe/Reader9/Resource/Support/AdobeReader.desktop"
167
168        PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-icon-resource forceupdate >/dev/null 2>&1
169
170        if [ `lsb_release -a |grep Release |awk -F" " '{print $2}'` != "8.04" ]; then
171                if [ `uname -m | cut -c 1` = "i" ]; then
172                        "$ReadInstallDir/Adobe/Reader9/Browser/install_browser_plugin" -silent -global "$ReadInstallDir" >/dev/null 2>&1
173                else
174                        nspluginwrapper -i /opt/Adobe/Reader9/Browser/intellinux/nppdf.so
175                fi
176        fi
177
178        . /usr/share/debconf/confmodule
179        db_version 2.0
180
181        db_get acroread-common/default-viewer
182
183        if [ "$RET" = "true" ]; then
184                if [ -e /etc/gnome/defaults.list ]; then
185                        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
186                            PATH="$ReadInstallDir/Adobe/Reader9/Reader/intellinux/bin:$PATH" xdg-mime default "acroread.desktop" "$i" >/dev/null 2>&1
187                        done
188                fi
189        fi
190    ;;
191
192    abort-upgrade|abort-remove|abort-deconfigure)
193    ;;
194
195    *)
196        echo "postinst called with unknown argument \`$1'" >&2
197        exit 0
198    ;;
199esac
200
201#DEBHELPER#
Note: See TracBrowser for help on using the repository browser.