#565990 dkms status should have the status as exit code

Package:
dkms
Source:
dkms
Submitter:
Evgeni Golov
Date:
2025-04-12 07:42:02 UTC
Severity:
wishlist
Tags:
#565990#5
Date:
2010-01-20 13:27:04 UTC
From:
To:
Hi,

currently, when one wants to check whether a module is installed to dkms, one
has to call
dkms status -m <module> -v <version>
and look for any output.
dkms *has* a -q option, which makes it silent, but the exit code is always 0,
regardless of the state of the module (existant or not). I'd expect a non-zero
one when the package is not installed.

Regards
Evgeni

#565990#16
Date:
2025-04-12 07:39:33 UTC
From:
To:
Hi Evgeni,

15 years ago you asked ...

dkms status can be called in many ways:

dkms status
dkms status -k <kernel> [-a <arch>]
dkms status -m <module>
dkms status -m <module> -v <version>
dkms status -m <module> -v <version> -k <kernel> [-a <arch>]

All but the last may report a list of modules/versions/kernels,
therefore a single status code is less useful.

For the last, where you query a single module/version/kernel/arch combo,
you can have 4-5 states as a result:

unknown
added
built
installed
broken

(sometimes with some additional information attached)
That's also not too helpful if it is mapped into a single status code.

Therefore I'd rather add some querying subcommands if there are some
real-world usecases for that, e.g.
dkms is_module_installed -m <module> -v <version> -k <kernel> -a <arch>
with three possible results:
0, no output - true
1, no output - false
 >1, error message - wrong query - too few or too many arguments

Andreas