updated on Sun Jan 22 12:09:12 UTC 2012
[aur-mirror.git] / backpackusb / convert_usermap_backpackusb.sh
bloba9b7891b0b1bf3b9c3cfc4caa8289a6cb7fb81c5
1 #!/bin/bash
3 # This script converts the usb.usermap file for the Micro Solutions
4 # Backpack drives to an udev rules file
6 # Copyright 2006 by Rob Kennedy <archpackages@gmail.com>
7 # Licence for this script: GPL2
10 cat "$1" | { while read map; do
12 if $(echo "$map" | grep -q ^# > /dev/null); then
13 echo $map >> backpackusb.rules
15 else
17 if [ -n "$map" ]; then
19 set $map
21 vid=$(echo $3 | cut -b3-)
22 pid=$(echo $4 | cut -b3-)
24 echo -e "SYSFS{idVendor}==\"$vid\", SYSFS{idProduct}==\"$pid\", RUN+=\"/lib/udev/backpackusb.sh\"" >> backpackusb.rules
30 done }
32 exit 0