File: preinst

package info (click to toggle)
sg-utils 0.95-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 604 kB
  • ctags: 867
  • sloc: ansic: 10,626; makefile: 159; sh: 39
file content (64 lines) | stat: -rw-r--r-- 1,661 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
# preinst script for sg-utils
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <new-preinst> `install'
#        * <new-preinst> `install' <old-version>
#        * <new-preinst> `upgrade' <old-version>
#        * <old-preinst> `abort-upgrade' <new-version>
#
# For details see /usr/share/doc/packaging-manual/

case "$1" in
    install|upgrade)
      kernel_version=`/bin/uname -r`;
      major_version=`echo $kernel_version | sed 's/\.[0-9]\+$//'`;
      minor_version=`echo $kernel_version | sed 's/.*\.\([0-9]\+\)/\1/'`;

      case $major_version in
        2.0)
	    echo "You are running linux kernel version $kernel_version."
	    echo "The following binaries from sg_utils will not work"
	    echo "with the version 1 sg driver:"
	    echo
	    echo "sg_whoami, sg_debug, sg_simple1, sgp_dd, sg_map, sg_test_rwbuf"
        ;;
	2.2)
	    if [ $minor_version -lt 7 ]; then
		echo "You are running linux kernel version $kernel_version."
		echo "The following binaries from sg_utils will not work"
		echo "with the version 1 sg driver:"
		echo
		echo "sg_whoami, sg_debug, sg_simple1, sgp_dd, sg_map, sg_test_rwbuf"
	    fi
	;;
	2.4)
	    echo "You are running linux kernel version $kernel_version."
	    echo "sg_utils will not work with a kernel version 2.4 or greater."
	    echo "Please install sg3_utils instead."
	    exit 1;
	;;
      esac
    ;;

    abort-upgrade)
    ;;

    *)
        echo "preinst called with unknown argument \`$1'" >&2
        exit 0
    ;;
esac

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

#DEBHELPER#

exit 0