File: postinst

package info (click to toggle)
dkms 2.2.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,084 kB
  • ctags: 61
  • sloc: sh: 3,542; makefile: 195; perl: 76; python: 62
file content (49 lines) | stat: -rw-r--r-- 1,233 bytes parent folder | download | duplicates (6)
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
#!/bin/sh
# Copyright (C) 2002-2005 Flavio Stanchina
# Copyright (C) 2005-2006 Aric Cyr
# Copyright (C) 2007 Mario Limonciello
# Copyright (C) 2009 Alberto Milone

set -e

NAME=MODULE_NAME
PACKAGE_NAME=$NAME-dkms
DEB_NAME=$(echo $PACKAGE_NAME | sed 's,_,-,')
CVERSION=`dpkg-query -W -f='${Version}' $DEB_NAME | awk -F "-" '{print $1}' | cut -d\: -f2`
ARCH=`dpkg --print-architecture`

dkms_configure () {
	for POSTINST in /usr/lib/dkms/common.postinst "/usr/share/$PACKAGE_NAME/postinst"; do
		if [ -f "$POSTINST" ]; then
			"$POSTINST" "$NAME" "$CVERSION" "/usr/share/$PACKAGE_NAME" "$ARCH" "$2"
			return $?
		fi
		echo "WARNING: $POSTINST does not exist." >&2
	done
	echo "ERROR: DKMS version is too old and $PACKAGE_NAME was not" >&2
	echo "built with legacy DKMS support." >&2
	echo "You must either rebuild $PACKAGE_NAME with legacy postinst" >&2
	echo "support or upgrade DKMS to a more current version." >&2
	return 1
}

case "$1" in
	configure)
		dkms_configure
	;;

	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