[Freedombox-discuss] Add dreamplug-detect script?
can you switch on something in uname -a?
On Sun, Aug 25, 2013 at 2:29 PM, Petter Reinholdtsen <pere at hungry.com>wrote:
> Hi.
>
> To make it easier for scripts in packages to know if the current
> environment is a dreamplug or not, I suggest we provide a
> /sbin/dreamplug-detect script for this purpose. This script should
> work, but might not be robust enough:
>
> #!/bin/sh
> #
> # Return true if running on a dreamplug, and false otherwise.
> #
> # Currently look for an armel machine with USB devices with IDS
> # 0d8c:000c and 05e3:0726. Perhaps a better way exist?
> # Based on details from <URL: https://wiki.debian.org/DreamPlugTesting >
>
> case $(dpkg --print-architecture) in
> armel)
> audiofound=false
> sdcardreaderfound=false
> for modalias in $(find /sys -name modalias -exec cat '{}' \;) ; do
> case $modalias in
> usb:v0D8Cp000Cd*) # C-Media Electronics, Inc. Audio Adapter
> audiofound=true
> ;;
> usb:v05E3p0726d*) # Genesys Logic, Inc. SD Card Reader
> sdcardreaderfound=true
> ;;
> esac
> done
> if $audiofound && $sdcardreaderfound ; then
> return 0
> fi
> return 1
> ;;
> *)
> return 1
> ;;
> esac
>
> Any objections? Suggestions for better implementation?
>
> --
> Happy hacking
> Petter Reinholdtsen
>
> _______________________________________________
> Freedombox-discuss mailing list
> Freedombox-discuss at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/freedombox-discuss
>
--
*"Anything created must necessarily be inferior to the essence of the
creator."
-- Claude Shouse (shouse at macomw.ARPA)
"Einstein's mother must have been one heck of a physicist."
-- Joseph C. Wang (joe at athena.mit.edu)
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/freedombox-discuss/attachments/20130825/793f5301/attachment.html>
Reply to: