[go: up one dir, main page]

File: postinst

package info (click to toggle)
file-rc 0.8.7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 308 kB
  • ctags: 37
  • sloc: sh: 1,835; makefile: 48
file content (71 lines) | stat: -rw-r--r-- 2,262 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
65
66
67
68
69
70
71
#! /bin/sh
# postinst script for file-rc
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
# quoting from the policy:
#     Any necessary prompting should almost always be confined to the
#     post-installation script, and should be protected with a conditional
#     so that unnecessary prompting doesn't happen if a package's
#     installation fails and the `postinst' is called with `abort-upgrade',
#     `abort-remove' or `abort-deconfigure'.

case "$1" in
    configure)
	# Versions older than 0.4.3 didn't support runlevel S properly.
	# The easiest way to fix this is to change everything back
	# to the link structure and then back again to the runlevel file.
	#
	if [ "$2" != "" ] && dpkg --compare-versions $2 lt 0.4.3
	then
	    echo "Updating runlevel.conf to support new runlevel S."
	    /usr/share/file-rc/rcfile2link.sh \
		&& rm -f /etc/runlevel.conf /etc/runlevel.fallback
	    if [ -f /etc/rc0.d/S05halt -o -f /etc/rc6.d/S05reboot ]
	    then
		echo "Correcting handling of halt and reboot"
		[ -f /etc/rc0.d/S05halt ] \
		    && mv -f /etc/rc0.d/S05halt /etc/rc0.d/S90halt
		[ -f /etc/rc6.d/S05reboot ] \
		    && mv -f /etc/rc6.d/S05reboot /etc/rc6.d/S90reboot
	    fi
	fi

	if [ -d /etc/rc0.d -a ! -f /etc/runlevel.conf ]
	then
	    /usr/share/file-rc/rclink2file.sh > /etc/runlevel.conf
	    cp /etc/runlevel.conf /etc/runlevel.fallback
	    ( cd / && tar czf /var/backups/rc-links.tar.gz etc/rc?.d )
	    rm -rf /etc/rc[0-6S].d
	fi
    ;;

    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