]> git.proxmox.com Git - ksm-control-daemon.git/blob - debian/postinst
bd1e873333d02ca0a6b561113df9fbcbeeb82992
[ksm-control-daemon.git] / debian / postinst
1 #! /bin/sh
2
3 # Abort if any command returns an error value
4 set -e
5
6 # This script is called as the last step of the installation of the
7 # package. All the package's files are in place, dpkg has already
8 # done its automatic conffile handling, and all the packages we depend
9 # of are already fully installed and configured.
10
11 # The following idempotent stuff doesn't generally need protecting
12 # against being run in the abort-* cases.
13
14
15 case "$1" in
16 configure)
17 # Configure this package. If the package must prompt the user for
18 # information, do it here.
19
20 # There are three sub-cases:
21 if test "${2+set}" != set; then
22 # We're being installed by an ancient dpkg which doesn't remember
23 # which version was most recently configured, or even whether
24 # there is a most recently configured version.
25 :
26
27 elif test -z "$2" -o "$2" = "<unknown>"; then
28 # The package has not ever been configured on this system, or was
29 # purged since it was last configured.
30 :
31
32 else
33 # Version $2 is the most recently configured version of this
34 # package.
35 :
36
37 fi ;;
38 abort-upgrade)
39 # Back out of an attempt to upgrade this package FROM THIS VERSION
40 # to version $2. Undo the effects of "prerm upgrade $2".
41 :
42
43 ;;
44 abort-remove)
45 if test "$2" != in-favour; then
46 echo "$0: undocumented call to \`postinst $*'" 1>&2
47 exit 0
48 fi
49 # Back out of an attempt to remove this package, which was due to
50 # a conflict with package $3 (version $4). Undo the effects of
51 # "prerm remove in-favour $3 $4".
52 :
53
54 ;;
55 abort-deconfigure)
56 if test "$2" != in-favour -o "$5" != removing; then
57 echo "$0: undocumented call to \`postinst $*'" 1>&2
58 exit 0
59 fi
60 # Back out of an attempt to deconfigure this package, which was
61 # due to package $6 (version $7) which we depend on being removed
62 # to make way for package $3 (version $4). Undo the effects of
63 # "prerm deconfigure in-favour $3 $4 removing $6 $7".
64 :
65
66 ;;
67 *) echo "$0: didn't understand being called with \`$1'" 1>&2
68 exit 0;;
69 esac
70
71 if [ -x "/etc/init.d/ksmtuned" ]; then
72 update-rc.d ksmtuned defaults 21 >/dev/null 2>&1
73 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
74 invoke-rc.d ksmtuned start || exit $?
75 else
76 /etc/init.d/ksmtuned start || exit $?
77 fi
78 fi
79
80 exit 0