~ubuntu-branches/ubuntu/hardy/vm/hardy

« back to all changes in this revision

Viewing changes to debian/postinst.codec

  • Committer: Bazaar Package Importer
  • Author(s): Manoj Srivastava
  • Date: 2005-05-02 23:57:59 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050502235759-lsq60hinwkchrbxp
Tags: 7.19-4
* Bug fix: "vm: Please do not discriminate against XEmacs", thanks to
  Dirk Eddelbuettel. Well, back in the mists of time, VM was packaged to
  be byte-compiled for XEmacs, but the XEmacs maintainer at that time
  asked me to cease and desist. Times change, so that is reverted. 
                                                        (Closes: #306876).
* Bug fix: "vm: purge doesn't", thanks to Ian Zimmerman. This should be
  better.                                               (Closes: #303519).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
2
 
#                               -*- Mode: Sh -*- 
3
 
# postinst --- 
4
 
# Author           : Manoj Srivastava ( srivasta@tiamat.datasync.com ) 
5
 
# Created On       : Thu Oct 15 00:23:39 1998
6
 
# Created On Node  : tiamat.datasync.com
7
 
# Last Modified By : Manoj Srivastava
8
 
# Last Modified On : Sun Jul 22 23:28:02 2001
9
 
# Last Machine Used: glaurung.green-gryphon.com
10
 
# Update Count     : 16
11
 
# Status           : Unknown, Use with caution!
12
 
# HISTORY          : 
13
 
# Description      : 
14
 
15
 
16
 
 
17
 
 
18
 
# Abort if any command returns an error value
19
 
set -e
20
 
 
21
 
# This script is called as the last step of the installation of the
22
 
# package.  All the package's files are in place, dpkg has already done
23
 
# its automatic conffile handling, and all the packages we depend of
24
 
# are already fully installed and configured.
25
 
 
26
 
package_name=mime-codecs
27
 
 
28
 
if [ -z "package_name" ]; then
29
 
    print >&2 "Internal Error. Please report a bug."
30
 
    exit 1;
31
 
fi
32
 
 
33
 
#perl -e 'print readlink("/usr/doc/'$package_name'"), "\n"; '
34
 
case "$1" in
35
 
  configure)
36
 
    # Configure this package.  If the package must prompt the user for
37
 
    # information, do it here.
38
 
 
39
 
    if [ -d /usr/doc ]; then
40
 
        # Well, we still need to handle this. At this point, /usr/doc
41
 
        # can be a symlink
42
 
        
43
 
        if [  -d /usr/share/doc/$package_name ]; then
44
 
            # So the new doc dir exists, goody
45
 
            
46
 
            # well, either one of these is a symlink, they can be
47
 
            # pointing off _anywhere_
48
 
            cd /usr/doc/;
49
 
            target_dir=$(/bin/pwd);
50
 
            cd /usr/share/doc 
51
 
            starget_dir=$(/bin/pwd);
52
 
            cd /
53
 
 
54
 
            link_target="../share/doc/$package_name";
55
 
            cd /usr/doc/;
56
 
            if [ -d ../share/doc/ ]; then
57
 
                cd ../share/doc/
58
 
                ltarget=$(/bin/pwd);
59
 
                if [ "$starget_dir" = "$ltarget" ]; then
60
 
                    link_target="../share/doc/$package_name";
61
 
                else
62
 
                    link_target="/usr/share/doc/$package_name";
63
 
                fi
64
 
            else
65
 
                link_target="/usr/share/doc/$package_name"
66
 
            fi
67
 
 
68
 
 
69
 
            # Well, make sure that we do not get tripped up by the symlink
70
 
            if [ -L /usr/doc/$package_name ]; then
71
 
                rm -f /usr/doc/$package_name
72
 
            fi
73
 
 
74
 
            if [ "$target_dir" != "$starget_dir" ]; then
75
 
                # Ok. The directories are in different locations
76
 
                if [ -d /usr/doc/$package_name ]; then
77
 
                    echo "Yikes! The old directory, /usr/doc/$package_name,"
78
 
                    echo "has not ben removed! This is an error; attempting"
79
 
                    echo "repairs."
80
 
                    find /usr/doc/$package_name/ -type f -name .dhelp \
81
 
                        -exec rm {} \;
82
 
                    find /usr/doc/$package_name/ -type d -depth \
83
 
                         -exec rmdir --ignore-fail-on-non-empty {} \;
84
 
 
85
 
                    if [ -d /usr/doc/$package_name ]; then
86
 
                        cat <<EOF 
87
 
Failed repairs. There are old files in /usr/doc/$package_name/ created
88
 
by you or another script. I can copy them over to the new location
89
 
/usr/share/doc/$package_name, if you wish, preserving your versions of
90
 
the files.  No files shall be over written, instead, backup versions
91
 
shall be created in /usr/share/doc/$package_name as needed.
92
 
 
93
 
Shall I copy the files over [Yn]?
94
 
EOF
95
 
                        read answer;
96
 
                        case "$answer" in
97
 
                            [Nn]*)
98
 
                                echo "Not copying over, aborting";
99
 
                                exit 1;
100
 
                                ;;      
101
 
                            *)
102
 
                                cp -a --backup=t /usr/doc/$package_name  \
103
 
                                    /usr/share/doc/$package_name/.. ;
104
 
                                rm -rf /usr/doc/$package_name;
105
 
                        esac
106
 
                    fi
107
 
                fi
108
 
 
109
 
                if [ -e /usr/doc/$package_name ]; then
110
 
                    echo "/usr/doc/$package_name still exists"
111
 
                    if [ -L /usr/doc/$package_name ]; then
112
 
                        echo "it is a symbolic link, overwriting"
113
 
                        ln -sf $link_target /usr/doc/$package_name
114
 
                    else
115
 
                        echo "This is an error. Aborting"
116
 
                        exit 1
117
 
                    fi
118
 
                fi
119
 
                # File unexists. Free to go ahead and create link
120
 
                ln -sf $link_target /usr/doc/$package_name
121
 
 
122
 
            fi
123
 
        fi
124
 
    fi
125
 
 
126
 
 
127
 
 
128
 
 
129
 
    # There are three sub-cases:
130
 
    if test "${2+set}" != set; then
131
 
      # We're being installed by an ancient dpkg which doesn't remember
132
 
      # which version was most recently configured, or even whether
133
 
      # there is a most recently configured version.
134
 
      :
135
 
 
136
 
    elif test -z "$2" -o "$2" = "<unknown>"; then
137
 
      # The package has not ever been configured on this system, or was
138
 
      # purged since it was last configured.
139
 
      :
140
 
 
141
 
    else
142
 
      # Version $2 is the most recently configured version of this
143
 
      # package.
144
 
      :
145
 
 
146
 
    fi 
147
 
 
148
 
    ;;
149
 
 
150
 
  abort-upgrade)
151
 
    # Back out of an attempt to upgrade this package FROM THIS VERSION
152
 
    # to version $2.  Undo the effects of "prerm upgrade $2".
153
 
    :
154
 
 
155
 
    ;;
156
 
  abort-remove)
157
 
    if test "$2" != in-favour; then
158
 
      echo "$0: undocumented call to \`postinst $*'" 1>&2
159
 
      exit 0
160
 
    fi
161
 
    # Back out of an attempt to remove this package, which was due to
162
 
    # a conflict with package $3 (version $4).  Undo the effects of
163
 
    # "prerm remove in-favour $3 $4".
164
 
    :
165
 
 
166
 
    ;;
167
 
  abort-deconfigure)
168
 
    if test "$2" != in-favour -o "$5" != removing; then
169
 
      echo "$0: undocumented call to \`postinst $*'" 1>&2
170
 
      exit 0
171
 
    fi
172
 
    # Back out of an attempt to deconfigure this package, which was
173
 
    # due to package $6 (version $7) which we depend on being removed
174
 
    # to make way for package $3 (version $4).  Undo the effects of
175
 
    # "prerm deconfigure in-favour $3 $4 removing $6 $7".
176
 
    :
177
 
 
178
 
    ;;
179
 
  *) echo "$0: didn't understand being called with \`$1'" 1>&2
180
 
     exit 0;;
181
 
esac
182
 
 
183
 
exit 0
184