File: perl-5.005-base.postinst

package info (click to toggle)
perl-transition 6.3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 76 kB
  • ctags: 2
  • sloc: sh: 230; makefile: 22
file content (47 lines) | stat: -rwxr-xr-x 1,131 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh -e

#DEBHELPER#

if [ "$1" = configure ]
then
    # clean up stray binary (dpkg doesn't know about perl-5.005 as it
    # was packaged as perl-5.005.dist and renamed in the postinst).
    rm -f /usr/bin/perl-5.005

    # more cruft, we don't ship this anymore
    rm -f /usr/bin/patchls

    # the old packages could remove /usr/local/lib in some cases
    if [ -w /usr/local ]
    then
	if [ ! -e /usr/local/lib ]
	then
	    mkdir /usr/local/lib
	    chown root:staff /usr/local/lib
	    chmod 2775 /usr/local/lib
	fi
    fi

    # see if we need to bother messing with alternatives
    [ -L /etc/alternatives/perl ] || exit 0

    # update-alternatives is currently a perl program
    if [ ! -x /usr/bin/perl ]
    then
	echo "Error: no /usr/bin/perl, can't clean up old alternatives."
	exit 0
    fi

    # u-a may destroy the target
    preserve=/usr/bin/perl.preserve-during-upgrade
    ln /usr/bin/perl $preserve

    $preserve -S update-alternatives --auto perl
    $preserve -S update-alternatives --remove perl /usr/bin/perl-5.005

    # restore
    rm -f /usr/bin/perl
    mv $preserve /usr/bin/perl
fi

exit 0