mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-10-17 22:22:44 +00:00
rules_generator: net rules - do not print error if file is missing and ignore commented rules
Fix an error message displayed by write_net_rules when the rules file does not exist yet. (See Debian bugs #442796 and #475699.) Ignore commented rules, at least for the easy case. For clarity, use extended instead of standard regular expressions.
This commit is contained in:
committed by
Kay Sievers
parent
9d2a06d7c6
commit
03effd3bc9
@@ -92,6 +92,10 @@ 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"')"[[:space:]]*(,.*|\\|)$'
|
||||
|
||||
echo $(sed -n -r -e 's/^#.*//' -e "${match}s/${search}/\1/p" \
|
||||
$RO_RULES_FILE \
|
||||
$([ -e $RULES_FILE ] && echo $RULES_FILE) \
|
||||
2>/dev/null)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user