Merge lp:~vanvugt/ubuntu/oneiric/bcmwl/fix-776439 into lp:ubuntu/oneiric/bcmwl

Proposed by Daniel van Vugt
Status: Merged
Merged at revision: 31
Proposed branch: lp:~vanvugt/ubuntu/oneiric/bcmwl/fix-776439
Merge into: lp:ubuntu/oneiric/bcmwl
Diff against target: 16 lines (+4/-2)
1 file modified
debian/bcmwl-kernel-source.prerm (+4/-2)
To merge this branch: bzr merge lp:~vanvugt/ubuntu/oneiric/bcmwl/fix-776439
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+62840@code.launchpad.net

Commit message

Failing to remove a DKMS module that does not exist is not an error (LP: #776439)

Description of the change

The prerm script for bcmwl-kernel-source was often failing to remove a DKMS module that did not exist. Failing to remove something that does not exist should not mean the overall remove operation should fail.

This patch ensures that if the DKMS module does not exist, then prerm doesn't fail trying to remove it (LP: #776439)

It is true that the root cause of this bug is failure to install the DKMS module in the first place. However that failure would always be visible as a failure during installation, and should be treated as a separate bug/s.

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

This fix also needs to be back-ported to natty.

Revision history for this message
Michael Terry (mterry) wrote :

I think it would be safer to just add || true to the end of the line, no? That way, no matter what error it gives, we'll be able to continue. And we don't have to worry about counting the modules. I'll make that change and merge.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Michael, your suggestion is incorrect. I thought of it already.

The problem with adding || true to the end of the line is that you then prevent any other future errors from "dkms remove" from being emitted.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

A possibly more elegant solution would be:

if [ $count -gt 0 ]; then
  dkms remove -m bcmwl -v $CVERSION --all > /dev/null
fi

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/bcmwl-kernel-source.prerm'
2--- debian/bcmwl-kernel-source.prerm 2010-11-25 15:06:14 +0000
3+++ debian/bcmwl-kernel-source.prerm 2011-05-30 07:13:08 +0000
4@@ -10,8 +10,10 @@
5 CVERSION=`dpkg-query -W -f='${Version}' bcmwl-kernel-source | awk -F "-" '{print $1}' | cut -d\: -f2`
6 case "$1" in
7 remove|upgrade)
8- echo "Removing all DKMS Modules"
9- dkms remove -m bcmwl -v $CVERSION --all > /dev/null
10+ count=`dkms status -m bcmwl -v $CVERSION | wc -l`
11+ echo "Removing all DKMS Modules ($count)"
12+ [ $count -le 0 ] && true ||
13+ dkms remove -m bcmwl -v $CVERSION --all > /dev/null
14 echo "Done."
15 ;;
16 esac

Subscribers

People subscribed via source and target branches