X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=extras%2Frule_generator%2Frule_generator.functions;h=e2060a2ece02c8b13b22f6f4d0c5a7bb08494a36;hb=8b5651bb009bf892b3a5537c5f36b8891f238aa4;hp=495bb7b04743caad1fe402521ecfc16e2b33e1bf;hpb=dcfa2acce30c0574bcec761b72cad4141da78e1b;p=elogind.git diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions index 495bb7b04..e2060a2ec 100644 --- a/extras/rule_generator/rule_generator.functions +++ b/extras/rule_generator/rule_generator.functions @@ -1,8 +1,22 @@ # functions used by the udev rule generator + +# Copyright (C) 2006 Marco d'Itri + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +PATH='/sbin:/bin' # -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation version 2 of the License. PATH='/sbin:/bin' @@ -92,6 +106,9 @@ find_all_rules() { local linkre="$2" local match="$3" - local search='.*[[:space:],]'"$key"'"\('"$linkre"'\)"[[:space:]]*\(,.*\|\\\|\)$' - echo $(sed -n -e "${match}s/${search}/\1/p" $RO_RULES_FILE $RULES_FILE 2>/dev/null) + local search='.*[[:space:],]'"$key"'"('"$linkre"')".*' + echo $(sed -n -r -e 's/^#.*//' -e "${match}s/${search}/\1/p" \ + $RO_RULES_FILE \ + $([ -e $RULES_FILE ] && echo $RULES_FILE) \ + 2>/dev/null) }