From d9540438ac067e1bbb00983450e9b6840ee1092c Mon Sep 17 00:00:00 2001 From: Etienne Perot Date: Mon, 2 Sep 2013 10:50:19 -0700 Subject: [PATCH] Make udev rule more specific and export PATH prior to calling `which` --- functions.sh | 1 + install-udev-rules.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/functions.sh b/functions.sh index ab6acc1..19ab86d 100644 --- a/functions.sh +++ b/functions.sh @@ -1,4 +1,5 @@ programExists() { + export PATH which "$1" &> /dev/null return "$?" } diff --git a/install-udev-rules.sh b/install-udev-rules.sh index c9aa186..5889696 100755 --- a/install-udev-rules.sh +++ b/install-udev-rules.sh @@ -94,7 +94,7 @@ echo '# As such, any changes you make here will be overwritten during the next r echo '' >> "$output_rule" # Empty line for device in "${!macAddresses[@]}"; do echo "# macchiato-data: $device = ${macAddresses[$device]}" >> "$output_rule" - echo "ACTION==\"add\", ATTR{address}==\"${macAddresses[$device]}\", RUN+=\"$bash_bin '$macchiato_bin' '$confDir' '$device'\"" >> "$output_rule" + echo "ACTION==\"add\", SUBSYSTEM==\"net\", ATTR{address}==\"${macAddresses[$device]}\", RUN+=\"$bash_bin '$macchiato_bin' '$confDir' '$device'\"" >> "$output_rule" echo '' >> "$output_rule" # Empty line done echo "All done. udev rules have been written to '$output_rule'"