dracut-functions: add inst_rule_group_owner()
add inst_rule_group_owner() to install GROUP and OWNER of udev rulesmaster
parent
da9c518116
commit
e0a393361d
|
@ -869,6 +869,26 @@ inst_rule_programs() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# attempt to install any programs specified in a udev rule
|
||||||
|
inst_rule_group_owner() {
|
||||||
|
local i
|
||||||
|
|
||||||
|
if grep -qE 'OWNER=?"[^ "]+' "$1"; then
|
||||||
|
for i in $(grep -E 'OWNER=?"[^ "]+' "$1" | sed -r 's/.*OWNER=?"([^ "]+).*/\1/'); do
|
||||||
|
if ! egrep -q "^$i:" "$initdir/etc/passwd" 2>/dev/null; then
|
||||||
|
egrep "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if grep -qE 'GROUP=?"[^ "]+' "$1"; then
|
||||||
|
for i in $(grep -E 'GROUP=?"[^ "]+' "$1" | sed -r 's/.*GROUP=?"([^ "]+).*/\1/'); do
|
||||||
|
if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then
|
||||||
|
egrep "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# udev rules always get installed in the same place, so
|
# udev rules always get installed in the same place, so
|
||||||
# create a function to install them to make life simpler.
|
# create a function to install them to make life simpler.
|
||||||
inst_rules() {
|
inst_rules() {
|
||||||
|
@ -882,6 +902,7 @@ inst_rules() {
|
||||||
if [[ -f $r/$_rule ]]; then
|
if [[ -f $r/$_rule ]]; then
|
||||||
_found="$r/$_rule"
|
_found="$r/$_rule"
|
||||||
inst_rule_programs "$_found"
|
inst_rule_programs "$_found"
|
||||||
|
inst_rule_group_owner "$_found"
|
||||||
inst_simple "$_found"
|
inst_simple "$_found"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -890,6 +911,7 @@ inst_rules() {
|
||||||
if [[ -f ${r}$_rule ]]; then
|
if [[ -f ${r}$_rule ]]; then
|
||||||
_found="${r}$_rule"
|
_found="${r}$_rule"
|
||||||
inst_rule_programs "$_found"
|
inst_rule_programs "$_found"
|
||||||
|
inst_rule_group_owner "$_found"
|
||||||
inst_simple "$_found" "$_target/${_found##*/}"
|
inst_simple "$_found" "$_target/${_found##*/}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue