| 1 | #! /bin/sh |
| 2 | # -*- Mode: Sh -*- |
| 3 | # prerm --- |
| 4 | # Author : Manoj Srivastava ( [email protected] ) |
| 5 | # Created On : Fri Nov 14 12:16:39 2003 |
| 6 | # Created On Node : glaurung.green-gryphon.com |
| 7 | # Last Modified By : Neil Roeth ([email protected]) |
| 8 | # Last Modified On : Saturday, May 23, 2009 |
| 9 | # Status : Unknown, Use with caution! |
| 10 | # HISTORY : |
| 11 | # Description : |
| 12 | # |
| 13 | # This program is free software; you can redistribute it and/or modify |
| 14 | # it under the terms of the GNU General Public License as published by |
| 15 | # the Free Software Foundation; either version 2 of the License, or |
| 16 | # (at your option) any later version. |
| 17 | # |
| 18 | # This program is distributed in the hope that it will be useful, |
| 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | # GNU General Public License for more details. |
| 22 | # |
| 23 | # You should have received a copy of the GNU General Public License |
| 24 | # along with this program; if not, write to the Free Software |
| 25 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 26 | # |
| 27 | # |
| 28 | |
| 29 | # Abort if any command returns an error value |
| 30 | set -e |
| 31 | |
| 32 | package_name=psgml |
| 33 | |
| 34 | if [ -z "$package_name" ]; then |
| 35 | print >&2 "Internal Error. Please report a bug." |
| 36 | exit 1; |
| 37 | fi |
| 38 | |
| 39 | |
| 40 | # This script is called as the first step in removing the package from |
| 41 | # the system. This includes cases where the user explicitly asked for |
| 42 | # the package to be removed, upgrade, automatic removal due to conflicts, |
| 43 | # and deconfiguration due to temporary removal of a depended-on package. |
| 44 | |
| 45 | case "$1" in |
| 46 | remove) |
| 47 | # This package about to be removed. |
| 48 | : |
| 49 | |
| 50 | # Get rid of the byte compiled files |
| 51 | if [ -x /usr/lib/emacsen-common/emacs-package-remove ]; then |
| 52 | /usr/lib/emacsen-common/emacs-package-remove --prerm $package_name |
| 53 | fi |
| 54 | |
| 55 | if [ -L /usr/doc/$package_name ]; then |
| 56 | rm -f /usr/doc/$package_name |
| 57 | fi |
| 58 | |
| 59 | # There are two sub-cases: |
| 60 | if test "${2+set}" = set; then |
| 61 | if test "$2" != in-favour; then |
| 62 | echo "$0: undocumented call to \`prerm $*'" 1>&2 |
| 63 | exit 0 |
| 64 | fi |
| 65 | # We are being removed because of a conflict with package $3 |
| 66 | # (version $4), which is now being installed. |
| 67 | : |
| 68 | |
| 69 | else |
| 70 | # The package is being removed in its own right. |
| 71 | : |
| 72 | |
| 73 | fi ;; |
| 74 | deconfigure) |
| 75 | if test "$2" != in-favour || test "$5" != removing; then |
| 76 | echo "$0: undocumented call to \`prerm $*'" 1>&2 |
| 77 | exit 0 |
| 78 | fi |
| 79 | # Package $6 (version $7) which we depend on is being removed due |
| 80 | # to a conflict with package $3 (version $4), and this package is |
| 81 | # being deconfigured until $6 can be reinstalled. |
| 82 | : |
| 83 | |
| 84 | ;; |
| 85 | upgrade) |
| 86 | # Prepare to upgrade FROM THIS VERSION of this package to version $2. |
| 87 | : |
| 88 | |
| 89 | # Get rid of the byte compiled files |
| 90 | if [ -x /usr/lib/emacsen-common/emacs-package-remove ]; then |
| 91 | /usr/lib/emacsen-common/emacs-package-remove --prerm $package_name |
| 92 | fi |
| 93 | if [ -L /usr/doc/$package_name ]; then |
| 94 | rm -f /usr/doc/$package_name |
| 95 | fi |
| 96 | |
| 97 | ;; |
| 98 | failed-upgrade) |
| 99 | # Prepare to upgrade from version $2 of this package TO THIS VERSION. |
| 100 | # This is only used if the old version's prerm couldn't handle it, |
| 101 | # and returned non-zero. (Fix old prerm bugs here.) |
| 102 | : |
| 103 | # Get rid of the byte compiled files |
| 104 | if [ -x /usr/lib/emacsen-common/emacs-package-remove ]; then |
| 105 | /usr/lib/emacsen-common/emacs-package-remove --prerm $package_name |
| 106 | fi |
| 107 | |
| 108 | ;; |
| 109 | *) echo "$0: didn't understand being called with \`$1'" 1>&2 |
| 110 | exit 0;; |
| 111 | esac |
| 112 | |
| 113 | exit 0 |