summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtools/ak3-core.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/ak3-core.sh b/tools/ak3-core.sh
index ac04275..4268992 100755
--- a/tools/ak3-core.sh
+++ b/tools/ak3-core.sh
@@ -37,6 +37,30 @@ file_getprop() {
}
###
+### file/directory attributes functions:
+# set_perm <owner> <group> <mode> <file> [<file2> ...]
+set_perm() {
+ local uid gid mod;
+ uid=$1; gid=$2; mod=$3;
+ shift 3;
+ chown $uid:$gid "$@" || chown $uid.$gid "$@";
+ chmod $mod "$@";
+}
+
+# set_perm_recursive <owner> <group> <dir_mode> <file_mode> <dir> [<dir2> ...]
+set_perm_recursive() {
+ local uid gid dmod fmod;
+ uid=$1; gid=$2; dmod=$3; fmod=$4;
+ shift 4;
+ while [ "$1" ]; do
+ chown -R $uid:$gid "$1" || chown -R $uid.$gid "$1";
+ find "$1" -type d -exec chmod $dmod {} +;
+ find "$1" -type f -exec chmod $fmod {} +;
+ shift;
+ done;
+}
+###
+
### dump_boot functions:
# split_boot (dump and split image only)
split_boot() {