Skip to content

Instantly share code, notes, and snippets.

@hydra35
Created January 7, 2012 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hydra35/1573811 to your computer and use it in GitHub Desktop.
Save hydra35/1573811 to your computer and use it in GitHub Desktop.
archlinux's modules detection through sysfs
auto_modules() {
# Perform auto detection of modules via sysfs.
local mods=
IFS=$'\n' read -rd '' -a mods < \
<(find /sys/devices -name modalias -exec sort -u {} + |
# delimit each input by a newline, expanded in place
xargs -d $'\n' modprobe -d "$BASEDIR" -aRS "$KERNELVERSION" |
sort -u)
printf "%s\n" "${mods[@]//-/_}"
(( ${#mods[*]} ))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment