summaryrefslogtreecommitdiff
path: root/extras/rule_generator
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-03-23 02:31:09 +0100
committerKay Sievers <kay.sievers@vrfy.org>2011-03-23 02:31:09 +0100
commit4ec9c3e79771aa95586390cecff4218cc8938160 (patch)
treee26e6bd8125ebcefbdf9674739df7573d17a040a /extras/rule_generator
parent3c6ee190277f9d4bf39269fdb167f9c430633c9b (diff)
use /run/udev/ if possible and fall back to /dev/.udev/
Diffstat (limited to 'extras/rule_generator')
-rw-r--r--extras/rule_generator/rule_generator.functions8
1 files changed, 5 insertions, 3 deletions
diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions
index e2060a2ece..4bec27a1b7 100644
--- a/extras/rule_generator/rule_generator.functions
+++ b/extras/rule_generator/rule_generator.functions
@@ -48,9 +48,10 @@ writeable() {
# Create a lock file for the current rules file.
lock_rules_file() {
- [ -e /dev/.udev/ ] || return 0
+ RUNDIR=$(udevadm info --run)
+ [ -e "$RUNDIR" ] || return 0
- RULES_LOCK="/dev/.udev/.lock-${RULES_FILE##*/}"
+ RULES_LOCK="$RUNDIR/.lock-${RULES_FILE##*/}"
retry=30
while ! mkdir $RULES_LOCK 2> /dev/null; do
@@ -71,7 +72,8 @@ unlock_rules_file() {
# Choose the real rules file if it is writeable or a temporary file if not.
# Both files should be checked later when looking for existing rules.
choose_rules_file() {
- local tmp_rules_file="/dev/.udev/tmp-rules--${RULES_FILE##*/}"
+ RUNDIR=$(udevadm info --run)
+ local tmp_rules_file="$RUNDIR/tmp-rules--${RULES_FILE##*/}"
[ -e "$RULES_FILE" -o -e "$tmp_rules_file" ] || PRINT_HEADER=1
if writeable ${RULES_FILE%/*}; then