X-Git-Url: http://pere.pagekite.me/gitweb/homepage.git/blobdiff_plain/bcd0bac910f20521ddebe3ff22337dec2aa23967..cec140bdf2d777199acb4d7c14066d510ce3ff93:/blog/data/2013-01-14-hw-autoinstall-modalias.txt diff --git a/blog/data/2013-01-14-hw-autoinstall-modalias.txt b/blog/data/2013-01-14-hw-autoinstall-modalias.txt index 7c03e552b4..4c8468f59f 100644 --- a/blog/data/2013-01-14-hw-autoinstall-modalias.txt +++ b/blog/data/2013-01-14-hw-autoinstall-modalias.txt @@ -1,6 +1,6 @@ Title: Modalias strings - a practical way to map "stuff" to hardware -Tags: english, debian -Date: 2013-01-14 11:15 +Tags: english, debian, isenkram +Date: 2013-01-14 11:20

While looking into how to look up Debian packages based on hardware information, to find the packages that support a given piece of @@ -23,7 +23,7 @@ values stands for. It is in part based on information from this shell script:

-cat $(find /sys -name modalias) | sort -u
+find /sys -name modalias -print0 | xargs -0 cat | sort -u
 

The supported modalias globs for a given kernel module can be found @@ -215,7 +215,7 @@ hardware to packages when new stuff is inserted during run time.

one can use the following shell script:

-  for id in $(cat $(find /sys -name modalias)|sort -u); do \
+  for id in $(find /sys -name modalias -print0 | xargs -0 cat | sort -u); do \
     echo "$id" ; \
     /sbin/modprobe --show-depends "$id"|sed 's/^/  /' ; \
   done
@@ -245,3 +245,7 @@ list is very long on my test machine):

packages to install when new hardware is plugged into a Debian machine, please send me an email or talk to me on #debian-devel.

+ +

Update 2013-01-15: Rewrite "cat $(find ...)" to +"find ... -print0 | xargs -0 cat" to make sure it handle directories +in /sys/ with space in them.