diff options
author | Harald Hoyer <harald@redhat.com> | 2012-10-04 13:04:36 -0400 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2012-10-04 13:04:36 -0400 |
commit | e0a393361d97c4ca5ed7a764893e9ea63fec1f81 (patch) | |
tree | 097c93bfeca01ad52e4392390a8bd55e16af7311 /dracut-functions.sh | |
parent | da9c5181167d170cb14a45eaaf55bf8d45339557 (diff) | |
download | dracut-e0a393361d97c4ca5ed7a764893e9ea63fec1f81.tar.gz dracut-e0a393361d97c4ca5ed7a764893e9ea63fec1f81.tar.bz2 dracut-e0a393361d97c4ca5ed7a764893e9ea63fec1f81.zip |
dracut-functions: add inst_rule_group_owner()
add inst_rule_group_owner() to install GROUP and OWNER of udev rules
Diffstat (limited to 'dracut-functions.sh')
-rwxr-xr-x | dracut-functions.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/dracut-functions.sh b/dracut-functions.sh index a71013e2..8f59ff45 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -869,6 +869,26 @@ inst_rule_programs() { 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 # create a function to install them to make life simpler. inst_rules() { @@ -882,6 +902,7 @@ inst_rules() { if [[ -f $r/$_rule ]]; then _found="$r/$_rule" inst_rule_programs "$_found" + inst_rule_group_owner "$_found" inst_simple "$_found" fi done @@ -890,6 +911,7 @@ inst_rules() { if [[ -f ${r}$_rule ]]; then _found="${r}$_rule" inst_rule_programs "$_found" + inst_rule_group_owner "$_found" inst_simple "$_found" "$_target/${_found##*/}" fi done |