mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-19 04:57:55 +00:00
insmod: uniformize module name and lsmod output prior of comapring if module already insmodded (ehci-hcd.ko module name is ehci_hcd...)
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
This commit is contained in:
parent
5f8cb5a159
commit
a5ab32b761
@ -23,11 +23,12 @@ if [ ! -r "$MODULE" ]; then
|
|||||||
die "$MODULE: not found?"
|
die "$MODULE: not found?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if module is already loaded while remove trailing .ko if present
|
# Check if module is already loaded
|
||||||
module=$(basename "$MODULE")
|
# Transform module name changing _ for - and trailing .ko if present
|
||||||
module=${module%.ko}
|
# Unify lsmod output to use - instead of _ for comparison
|
||||||
if lsmod | grep -q "^$module\\b"; then
|
module_name=$(basename "$MODULE" | sed 's/_/-/g' | sed 's/\.ko$//')
|
||||||
DEBUG "$module: already loaded"
|
if lsmod | sed 's/_/-/g' | grep -q "^$module_name\\b"; then
|
||||||
|
DEBUG "$MODULE: already loaded"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user