summaryrefslogtreecommitdiff
path: root/debian/postinst
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2008-11-09 18:31:48 +0100
committerHenrik Rydberg <rydberg@euromail.se>2008-11-09 18:31:48 +0100
commit9597a06b7f530d098060e97267ff0c55347771e3 (patch)
treeb0f4623fc0c3595767fe732909fe1b1c4018a763 /debian/postinst
Import from bzr: applesmc-dkms
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'debian/postinst')
-rw-r--r--debian/postinst71
1 files changed, 71 insertions, 0 deletions
diff --git a/debian/postinst b/debian/postinst
new file mode 100644
index 0000000..4e33034
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,71 @@
1#!/bin/sh
2
3set -e
4
5NAME=applesmc
6VERSION=0.12.3
7
8case "$1" in
9 configure)
10 # Determine current arch / kernel
11 c_arch=`uname -m`
12 c_kern=`uname -r`
13
14 if [ -e "/var/lib/dkms/$NAME/$VERSION" ]; then
15 echo "Removing old $NAME-$VERSION DKMS files..."
16 dkms remove -m $NAME -v $VERSION --all
17 fi
18
19 echo "Loading new $NAME-$VERSION DKMS files..."
20 #dkms add -m $NAME -v $VERSION
21 dkms ldtarball --archive "/usr/src/$NAME-$VERSION.dkms.tar.gz"
22 rm -f "/usr/src/$NAME-$VERSION.dkms.tar.gz"
23
24 echo "Installing prebuilt kernel module binaries (if any)"
25 set +e
26 IFS='
27'
28 for kern in `dkms status -m $NAME -v $VERSION -a $c_arch | grep ": built" | awk {'print $3'} | sed 's/,$//'`; do
29 echo "Trying kernel: $kern"
30 dkms install --force -m $NAME -v $VERSION -k $kern -a $c_arch
31 done
32 unset IFS
33 set -e
34
35 # If none installed, install.
36 ##if [ `dkms status -m $NAME -v $VERSION -k $c_kern -a $c_arch | grep -c ": installed"` -eq 0 ]; then
37 dkms_status=`dkms status -m $NAME -v $VERSION -k $c_kern -a $c_arch`
38 if [ `echo $dkms_status | grep -c ": installed"` -eq 0 ]; then
39 if [ `echo $c_kern | grep -c "BOOT"` -eq 0 ] && [ -e "/lib/modules/$c_kern/build/include" ]; then
40 # Only build if we need to.
41 if [ `echo $dkms_status | grep -c ": built"` -eq 0 ]; then
42 echo "Building module..."
43 dkms build -m $NAME -v $VERSION
44 fi
45 echo "Installing module..."
46 dkms install -m $NAME -v $VERSION
47 elif [ `echo $c_kern | grep -c "BOOT"` -gt 0 ]; then
48 echo -e ""
49 echo -e "Module build for the currently running kernel was skipped since you"
50 echo -e "are running a BOOT variant of the kernel."
51 else
52 echo -e ""
53 echo -e "Module build for the currently running kernel was skipped since the"
54 echo -e "kernel source for this kernel does not seem to be installed."
55 fi
56 fi
57 ;;
58
59 abort-upgrade|abort-remove|abort-deconfigure)
60 ;;
61
62 *)
63 echo "postinst called with unknown argument \`$1'" >&2
64 exit 1
65 ;;
66esac
67
68#DEBHELPER#
69
70exit 0
71