File: mksh.postinst

package info (click to toggle)
mksh 39.3.20100725-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,316 kB
  • ctags: 1,999
  • sloc: ansic: 21,506; sh: 1,349; perl: 967; makefile: 141
file content (64 lines) | stat: -rw-r--r-- 1,449 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#! /bin/sh
# $MirOS: contrib/hosted/tg/deb/mksh/debian/mksh.postinst,v 1.5 2009/04/07 20:55:54 tg Exp $
#-
# postinst script for mksh
#
# see: dh_installdeb(1)

set -e

check_divert() {
	div=$(dpkg-divert --list $2)
	distrib=${4:-$2.distrib}
	case $1 in
	true)
		if [ -z "$div" ]; then
			dpkg-divert --package mksh --divert $distrib --add $2
			cp -dp $2 $distrib
			ln -sf $3 $2
		fi
		;;
	false)
		if [ -n "$div" ] && [ -z "${div%%*by mksh}" ]; then
			mv $distrib $2
			dpkg-divert --package mksh --remove $2
		fi
		;;
	esac
}

. /usr/share/debconf/confmodule
db_get mksh/sh
check_divert "$RET" /bin/sh mksh
check_divert "$RET" /usr/share/man/man1/sh.1.gz mksh.1.gz \
    /usr/share/man/man1/sh.distrib.1.gz

case $1 in
configure)
	update-alternatives --install /bin/ksh ksh /bin/mksh 12 \
	    --slave /usr/bin/ksh usr.bin.ksh /bin/mksh \
	    --slave /usr/share/man/man1/ksh.1.gz ksh.1.gz \
	    /usr/share/man/man1/mksh.1.gz
	update-alternatives --install /bin/ksh ksh /bin/mksh-static 11 \
	    --slave /usr/bin/ksh usr.bin.ksh /bin/mksh-static \
	    --slave /usr/share/man/man1/ksh.1.gz ksh.1.gz \
	    /usr/share/man/man1/mksh.1.gz
	add-shell /bin/mksh
	add-shell /bin/mksh-static
	;;

abort-upgrade|abort-remove|abort-deconfigure)
	;;

*)
	echo "postinst called with unknown argument '$1'" >&2
	exit 1
	;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0