diff options
author | osm0sis <osm0sis@outlook.com> | 2018-07-16 13:56:07 -0300 |
---|---|---|
committer | osm0sis <osm0sis@outlook.com> | 2018-07-16 14:00:23 -0300 |
commit | 955f3ce4881843e78b09793c2ce7ee63b6e7ad23 (patch) | |
tree | 72508bfb4d64c48612a9a64b1d5830d57eabae90 | |
parent | 1811b87a196aeebdf279e1878f52e0f3428e8bc3 (diff) |
AK2: add patch_ueventd
- introduce function to modify or add entries to ueventd.rc using its spaced columns format, matched using the device node
-rwxr-xr-x | tools/ak2-core.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/ak2-core.sh b/tools/ak2-core.sh index 44f7cbc..74d690c 100755 --- a/tools/ak2-core.sh +++ b/tools/ak2-core.sh @@ -505,6 +505,21 @@ patch_prop() { fi; } +# patch_ueventd <ueventd file> <device node> <permissions> <chown> <chgrp> +patch_ueventd() { + local file dev perm user group newentry line; + file=$1; dev=$2; perm=$3; user=$4; + shift 4; + group="$@"; + newentry=$(printf "%-23s %-4s %-8s %s\n" "$dev" "$perm" "$user" "$group"); + line=`grep -n "$dev" $file | head -n1 | cut -d: -f1`; + if [ "$line" ]; then + sed -i "${line}s;.*;${newentry};" $file; + else + echo -ne "\n$newentry\n" >> $file; + fi; +} + # allow multi-partition ramdisk modifying configurations (using reset_ak) if [ ! -d "$ramdisk" -a ! -d "$patch" ]; then if [ -d "$(basename $block)-files" ]; then |