You are not logged in.
Pages: 1
A I learned, the '-l' switch - a it was present in m-i-t, doesn't exist for kmod. So what is your replacement for the lost '-l' functionality? Searching for *ko files in /lib/modules? Thats rather cumbersome...
Offline
What exactly did it do? A piece of the output and manpage might help my aging memory / imagination.
Offline
from Debian:
-l --list
List all modules matching the given wildcard (or "*" if no wildcard is given). This option is provided for backwards compatibility and may go away in future: see find(1) and basename(1) for a more flexible alternative.
simple function for .bashrc:
fkm() {
find /lib/modules/$(uname -r)/ -iname "*$1*.ko*" | cut -d/ -f5-
if [[ "$(uname -r)" != "$(/bin/ls -1 /lib/modules/ | head -1)" ]]; then
echo "Did you reboot after updating your kernel?"
fi
}
('find kernel module', or whatever you like)
[edit: wtf, trailing-whitespace-cleanup]
Last edited by byte (2012-01-26 11:32:03)
1000
Offline
Still would be nice, if kmod provided such a feature.
I like your function, thank you for sharing! But I like it more if the suffix is stripped:
fkm() {
find /lib/modules/$(uname -r)/ -iname "*$1*.ko*" -exec basename {} .ko.gz \;
if [[ "$(uname -r)" != "$(/bin/ls -1 /lib/modules/ | head -1)" ]]; then
echo "Did you reboot after updating your kernel?"
fi
}
Offline
needs more bash... dashes and underscores should be treated equally as well -- they're interchangeable in the land of modules, so automatically "escape" them into globs.
fkm() {
local kver=$(uname -r) arg=${1//[-_]/[-_]}
find "/lib/modules/$kver" -iname "*$arg*.ko*" \
-exec bash -c 'mods=("${@##*/}"); printf "%s\n" "${mods[@]%.ko*}"' _ {} +
if [[ ! -e /lib/modules/$kver/kernel ]]; then
echo "reboot!" >&2
fi
}
Offline
Pages: 1