chiark / gitweb /
rules_generator: remove executable flag from include file
[elogind.git] / extras / firmware / firmware.sh
1 #!/bin/sh -e
2
3 FIRMWARE_DIRS="/lib/firmware /usr/local/lib/firmware"
4
5 err() {
6     echo "$@" >&2
7     if [ -x /bin/logger ]; then
8         /bin/logger -t "${0##*/}[$$]" "$@"
9     fi
10 }
11
12 if [ ! -e /sys$DEVPATH/loading ]; then
13     err "udev firmware loader misses sysfs directory"
14     exit 1
15 fi
16
17 for DIR in $FIRMWARE_DIRS; do
18     [ -e "$DIR/$FIRMWARE" ] || continue
19     echo 1 > /sys$DEVPATH/loading
20     cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data
21     echo 0 > /sys$DEVPATH/loading
22     exit 0
23 done
24
25 echo -1 > /sys$DEVPATH/loading
26 err "Cannot find  firmware file '$FIRMWARE'"
27 exit 1