diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2008-10-24 23:53:30 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2008-10-24 23:53:30 +0200 |
| commit | eb8e529c4657c2e57e491ed8f38215708eed7fb5 (patch) | |
| tree | 37616977fc299521f97c43819b9d7e417ed79e74 /debian/postinst | |
| parent | 8c13725ebac26ba2ed72dc33fc23671dc8bfb766 (diff) | |
Reorganize into a usable debian dkms package
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'debian/postinst')
| -rw-r--r-- | debian/postinst | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..3bc6c41 --- /dev/null +++ b/debian/postinst | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -e | ||
| 4 | |||
| 5 | NAME=bcm5974 | ||
| 6 | VERSION=0.99 | ||
| 7 | |||
| 8 | case "$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 | ;; | ||
| 66 | esac | ||
| 67 | |||
| 68 | #DEBHELPER# | ||
| 69 | |||
| 70 | exit 0 | ||
| 71 | |||
