preinstall program: /bin/sh postinstall scriptlet (through /bin/sh): # # Check a given file in given path # Which() { OLD_IFS="$IFS" IFS=":" status=1 for i in $PATH; do if [ -x "$i/$1" ]; then echo "$i/$1" status=0 break fi done IFS="$OLD_IFS" return $status } ReadInstallDir="$RPM_INSTALL_PREFIX" ##SOFT LINK #remove any leftover if ( echo foo > /usr/bin/AcroWriteTest ) 2> /dev/null ; then rm -f /usr/bin/AcroWriteTest rm -f /usr/bin/acroread 2> /dev/null ##install link if [ -n "$ReadInstallDir" ]; then ln -s "$ReadInstallDir/Adobe/Reader8/bin/acroread" /usr/bin/acroread else ln -s /opt/Adobe/Reader8/bin/acroread /usr/bin/acroread fi fi record_config() { config_file="$ReadInstallDir/Adobe/Reader8/Reader/GlobalPrefs/.config" echo "$@" >> "$config_file" } install_icon() { PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-icon-resource install "$@" >/dev/null 2>&1 } install_desktop_menu() { PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-desktop-menu uninstall --mode system "$@" >/dev/null 2>&1 PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-desktop-menu uninstall --mode user "$@" >/dev/null 2>&1 PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-desktop-menu install "$@" >/dev/null 2>&1 } install_desktop_icon() { eval desktop_file="\$$#" PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-desktop-icon uninstall "$@" >/dev/null 2>&1 PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-desktop-icon install "$@" >/dev/null 2>&1 && chmod 777 "$HOME/Desktop/`basename "$desktop_file"`" 2>/dev/null } install_mime() { PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-mime install "$@" >/dev/null 2>&1 } InstallIcons() { install_dir="$1/Adobe/Reader8/Resource/Icons" for icon_size in 16 20 22 24 32 36 48 64 96 128 192; do install_icon --noupdate --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/AdobeReader8.png" install_icon --noupdate --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/adobe.pdf.png" install_icon --noupdate --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/adobe.pdf.png" 'application-pdf' install_icon --noupdate --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.fdf.png" install_icon --noupdate --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.fdf.png" 'application-fdf' install_icon --noupdate --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.pdx.png" install_icon --noupdate --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.pdx.png" 'application-pdx' install_icon --noupdate --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xdp+xml.png" install_icon --noupdate --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xdp+xml.png" 'application-xdp+xml' install_icon --noupdate --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xfdf.png" install_icon --noupdate --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xfdf.png" 'application-xfdf' done } MakeLibGnomeSpeechLinks() { install_dir="$1/Adobe/Reader8/Reader" configured_dir="$2" lib_dir="$install_dir/$configured_dir/lib" if TESTSPEECHEXEC="`Which test-speech`" && Which ldd >/dev/null && Which awk >/dev/null; then rm -f "$lib_dir/libORBit-2.so" 2>/dev/null rm -f "$lib_dir/libbonobo-2.so" 2>/dev/null rm -f "$lib_dir/libbonobo-activation.so" 2>/dev/null rm -f "$lib_dir/libgnomespeech.so" 2>/dev/null lib_orbit2="`ldd $TESTSPEECHEXEC 2>/dev/null | grep -i libORBit-2.* | cut -d '>' -f2 | cut -d '(' -f 1 |awk '{print $1}' `" lib_bonobo="`ldd $TESTSPEECHEXEC 2>/dev/null | grep -i bonobo-2.* | cut -d '>' -f2 | cut -d '(' -f 1 |awk '{print $1}' `" lib_bonoboactivation="`ldd $TESTSPEECHEXEC 2>/dev/null | grep -i bonobo-activation.* | cut -d '>' -f2 | cut -d '(' -f 1 |awk '{print $1}' `" lib_gnomespeech="`ldd $TESTSPEECHEXEC 2>/dev/null | grep -i libgnomespeech.* | cut -d '>' -f2 | cut -d '(' -f 1 |awk '{print $1}' `" if [ -f "$lib_orbit2" -a -f "$lib_bonobo" -a -f "$lib_bonoboactivation" -a -f "$lib_gnomespeech" ]; then ln -s "$lib_orbit2" "$lib_dir/libORBit-2.so" && record_config remove "$lib_dir/libORBit-2.so" ln -s "$lib_bonobo" "$lib_dir/libbonobo-2.so" && record_config remove "$lib_dir/libbonobo-2.so" ln -s "$lib_bonoboactivation" "$lib_dir/libbonobo-activation.so" && record_config remove "$lib_dir/libbonobo-activation.so" ln -s "$lib_gnomespeech" "$lib_dir/libgnomespeech.so" && record_config remove "$lib_dir/libgnomespeech.so" fi fi } MakeLibLDAPLinks() { install_dir="$1/Adobe/Reader8/Reader" if [ ! -e /usr/lib/libldap.so ] then rm -f "$install_dir/intellinux/lib/libldap.so" 2>/dev/null LIB_LDAP="`ls -tr /usr/lib/libldap.so* 2>/dev/null | tail -n 1`" if [ "$LIB_LDAP" = "" ] then LIB_LDAP="`ls -tr /usr/lib/libldap* 2>/dev/null | grep -v libldap_r | grep -v libldapcpp | grep '\.so' | tail -n 1`" fi if [ "$LIB_LDAP" != "" ] then ln -s "$LIB_LDAP" "$install_dir/intellinux/lib/libldap.so" && record_config remove "$install_dir/intellinux/lib/libldap.so" fi fi if [ ! -e /usr/lib/liblber.so ] then rm -f "$install_dir/intellinux/lib/liblber.so" 2>/dev/null LIB_LBER="`ls -tr /usr/lib/liblber.so* 2>/dev/null | tail -n 1`" if [ "$LIB_LBER" = "" ] then LIB_LBER="`ls -tr /usr/lib/liblber* 2>/dev/null | grep -v liblber_r | grep '\.so' | tail -n 1`" fi if [ "$LIB_LBER" != "" ] then ln -s "$LIB_LBER" "$install_dir/intellinux/lib/liblber.so" && record_config remove "$install_dir/intellinux/lib/liblber.so" fi fi } if Which kde-config >/dev/null 2>&1; then KDE_BASE_DIR="`kde-config --prefix`" elif [ -x /opt/kde3/bin/kde-config ]; then KDE_BASE_DIR="/opt/kde3" elif [ -x /opt/kde/bin/kde-config ]; then KDE_BASE_DIR="/opt/kde" else KDE_BASE_DIR="/usr" fi if GNOME_BASE_DIR="`Which gnome-open 2>/dev/null`"; then GNOME_BASE_DIR=`dirname "$GNOME_BASE_DIR"` GNOME_BASE_DIR=`dirname "$GNOME_BASE_DIR"` elif [ -x /opt/gnome/bin/gnome-open ]; then GNOME_BASE_DIR="/opt/gnome" else GNOME_BASE_DIR="/usr" fi MakeLibLDAPLinks "$ReadInstallDir" 2>/dev/null MakeLibGnomeSpeechLinks "$ReadInstallDir" intellinux 2>/dev/null InstallIcons "$ReadInstallDir" install_mime --novendor "$ReadInstallDir/Adobe/Reader8/Resource/Support/AdobeReader.xml" 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 PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-mime default "$ReadInstallDir/Adobe/Reader8/Resource/Support/AdobeReader.desktop" "$i" >/dev/null 2>&1 done install_desktop_menu --novendor "$ReadInstallDir/Adobe/Reader8/Resource/Support/AdobeReader.desktop" install_desktop_icon --novendor "$ReadInstallDir/Adobe/Reader8/Resource/Support/AdobeReader.desktop" PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-icon-resource forceupdate >/dev/null 2>&1 "$ReadInstallDir/Adobe/Reader8/Browser/install_browser_plugin" -silent -global -user "$ReadInstallDir" >/dev/null 2>&1 exit 0 preuninstall scriptlet (through /bin/sh): remove() { rm -f "$@" } uninstall_icon() { PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-icon-resource uninstall "$@" >/dev/null 2>&1 } uninstall_desktop_menu() { PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-desktop-menu uninstall "$@" >/dev/null 2>&1 } uninstall_desktop_icon() { PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-desktop-icon uninstall "$@" >/dev/null 2>&1 } uninstall_mime() { PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-mime uninstall "$@" >/dev/null 2>&1 } UnInstallIcons() { install_dir="$1/Adobe/Reader8/Resource/Icons" for icon_size in 16 22 24 32 48 64 128; do uninstall_icon --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/AdobeReader8.png" uninstall_icon --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/adobe.pdf.png" uninstall_icon --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/adobe.pdf.png" 'application-pdf' uninstall_icon --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.fdf.png" uninstall_icon --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.fdf.png" 'application-fdf' uninstall_icon --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.pdx.png" uninstall_icon --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.pdx.png" 'application-pdx' uninstall_icon --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xdp+xml.png" uninstall_icon --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xdp+xml.png" 'application-xdp+xml' uninstall_icon --novendor --context apps --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xfdf.png" uninstall_icon --novendor --context mimetypes --size $icon_size "$install_dir/${icon_size}x${icon_size}/vnd.adobe.xfdf.png" 'application-xfdf' done } TrimSpaces() { OLD_IFS_Trim_Spaces="$IFS" IFS=' ' echo $@ IFS="$OLD_IFS_Trim_Spaces" } ProcessConfigFile() { OLD_IFS_RestoreFiles="$IFS" config_file="$1" cat "$config_file" | grep -v "^[ ]*#" | \ while : do IFS=' ' read op args if [ $? -ne 0 -o -z "$op" ]; then break fi op="`TrimSpaces $op`" case "$op" in remove | uninstall_icon | uninstall_desktop_menu | uninstall_mime) "$op" $args 2>/dev/null ;; esac done IFS="$OLD_IFS_RestoreFiles" } ReadInstallDir="$RPM_INSTALL_PREFIX" config_file="$ReadInstallDir/Adobe/Reader8/Reader/GlobalPrefs/.config" UnInstallIcons "$ReadInstallDir" uninstall_desktop_menu "$ReadInstallDir/Adobe/Reader8/Resource/Support/AdobeReader.desktop" uninstall_desktop_icon "$ReadInstallDir/Adobe/Reader8/Resource/Support/AdobeReader.desktop" if [ -f "$config_file" ]; then ProcessConfigFile "$config_file" rm -f "$config_file" fi PATH="$PATH:$ReadInstallDir/Adobe/Reader8/Reader/intellinux/bin" xdg-icon-resource forceupdate >/dev/null 2>&1 postuninstall scriptlet (through /bin/sh): MkTempInternal() { if [ "${mktemp_count+set}" != "set" ]; then mktemp_count="0" fi mktemp_file="/tmp/acrobat.$$.${mktemp_count}" while /usr/bin/test -e "$mktemp_file" do mktemp_count="`expr $mktemp_count + 1`" mktemp_file="/tmp/acrobat.$$.${mktemp_count}" done touch "$mktemp_file" && chmod 600 "$mktemp_file" && echo "$mktemp_file" } MkTemp() { template="tmp.XXXXXXXXXX"; MKTEMP="`which mktemp 2>/dev/null`"; if [ "$MKTEMP" != "" ]; then : else MKTEMP="MkTempInternal"; fi $MKTEMP /tmp/acrobat.$template } ## kill synchronizerapp tmpfile="`MkTemp`" ps -ef 2>/dev/null > "$tmpfile" synchronizerapp_pid="`awk '{ print $8, $2 }' < "$tmpfile" | grep -w "^$ReadInstallDir/Adobe/Reader8/Reader/intellinux/SynchronizerApp" | awk '{ print $NF; exit }'`" if [ -z "$synchronizerapp_pid" ]; then ps auwwwxg 2>/dev/null > "$tmpfile" synchronizerapp_pid="`awk '{ print $11, $2 }' < "$tmpfile" | grep -w "^$ReadInstallDir/Adobe/Reader8/Reader/intellinux/SynchronizerApp" | awk '{ print $NF; exit }'`" if [ -z "$synchronizerapp_pid" ]; then rm -f "$tmpfile" exit 0 fi fi rm -f "$tmpfile" if [ -n "$synchronizerapp_pid" ]; then kill -KILL "$synchronizerapp_pid" fi exit 0