[arch-commits] Commit in systemd/trunk (initcpio-install-systemd)
Dave Reisner
dreisner at nymeria.archlinux.org
Tue Jul 23 12:59:56 UTC 2013
Date: Tuesday, July 23, 2013 @ 14:59:56
Author: dreisner
Revision: 191302
fix parsing of binaries from udev rules
Modified:
systemd/trunk/initcpio-install-systemd
--------------------------+
initcpio-install-systemd | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
Modified: initcpio-install-systemd
===================================================================
--- initcpio-install-systemd 2013-07-23 12:44:57 UTC (rev 191301)
+++ initcpio-install-systemd 2013-07-23 12:59:56 UTC (rev 191302)
@@ -1,5 +1,13 @@
#!/bin/bash
+strip_quotes() {
+ local len=${#1} quotes=$'[\'"]' str=${!1}
+
+ if [[ ${str:0:1} = ${str: -1} && ${str:0:1} = $quotes ]]; then
+ declare -g "$1=${str:1:-1}"
+ fi
+}
+
add_udev_rule() {
# Add an udev rules file to the initcpio image. Dependencies on binaries
# will be discovered and added.
@@ -17,11 +25,12 @@
while IFS=, read -ra rule; do
for pair in "${rule[@]}"; do
- IFS='=' read -r key value <<< "$pair"
-
+ IFS=' =' read -r key value <<< "$pair"
+ strip_quotes 'value'
case $key in
RUN@({program}|+)|IMPORT{program}|ENV{REMOVE_CMD})
- binary=${value[0]#\"}
+ # just take the first word as the binary name
+ binary=${value%% *}
if [[ ${binary:0:1} != '/' ]]; then
binary=$(PATH=/usr/lib/udev:/lib/udev type -P "$binary")
fi
@@ -29,7 +38,7 @@
;;
esac
done
- done < "$rules"
+ done <"$rules"
}
add_systemd_unit() {
@@ -63,7 +72,7 @@
;;
esac
- done < "$unit"
+ done <"$unit"
# preserve reverse soft dependency
for dep in {/usr,}/lib/systemd/system/*.wants/${unit##*/}; do
More information about the arch-commits
mailing list