diff options
author | Michael Gilchrist <michaelgilch@gmail.com> | 2021-03-21 14:00:13 +0000 |
---|---|---|
committer | David P <megver83@parabola.nu> | 2021-03-21 14:27:17 -0300 |
commit | 5de12e95b7bfb9a56f68436e0ecc3298ee09591d (patch) | |
tree | 87000041700406fd2a1dc39b48b64c2e5b8f30c1 | |
parent | 1bad1f568981341c38afd9dfc33f68186358263a (diff) |
Recursively change file permissions for folders listed in profiledef.sh
- if a folder listed in the associative array ends with a "/",
recursively apply chmod and chown.
-rw-r--r-- | README.profile.rst | 2 | ||||
-rwxr-xr-x | parabolaiso/mkparabolaiso | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/README.profile.rst b/README.profile.rst index f8c3bfa..bac69b5 100644 --- a/README.profile.rst +++ b/README.profile.rst @@ -57,7 +57,7 @@ The image file is constructed from some of the variables in **profiledef.sh**: ` `('-comp' 'xz')` for squashfs). * `file_permissions`: An associative array that lists files and/or directories who need specific ownership or permissions. The array's keys contain the path and the value is a colon separated list of owner UID, owner GID and - access mode. E.g. `file_permissions=(["/etc/shadow"]="0:0:400")`. + access mode. E.g. `file_permissions=(["/etc/shadow"]="0:0:400")`. When directories are listed with a trailing backslash ("/") **all** files and directories contained within the listed directory will have the same owner UID, owner GID, and access mode applied recursively. packages.arch ============= diff --git a/parabolaiso/mkparabolaiso b/parabolaiso/mkparabolaiso index 6876396..23df067 100755 --- a/parabolaiso/mkparabolaiso +++ b/parabolaiso/mkparabolaiso @@ -317,8 +317,13 @@ _make_custom_airootfs() { elif [[ ! -e "${airootfs_dir}${filename}" ]]; then _msg_warning "Cannot change permissions of '${airootfs_dir}${filename}'. The file or directory does not exist." else - chown -fh -- "${permissions[0]}:${permissions[1]}" "${airootfs_dir}${filename}" - chmod -f -- "${permissions[2]}" "${airootfs_dir}${filename}" + if [[ "${filename: -1}" == "/" ]]; then + chown -fhR -- "${permissions[0]}:${permissions[1]}" "${airootfs_dir}${filename}" + chmod -fR -- "${permissions[2]}" "${airootfs_dir}${filename}" + else + chown -fh -- "${permissions[0]}:${permissions[1]}" "${airootfs_dir}${filename}" + chmod -f -- "${permissions[2]}" "${airootfs_dir}${filename}" + fi fi done _msg_info "Done!" |