diff --git a/shared/templates/file_groupowner/bash.template b/shared/templates/file_groupowner/bash.template index f4b9d577219..22847cd4409 100644 --- a/shared/templates/file_groupowner/bash.template +++ b/shared/templates/file_groupowner/bash.template @@ -5,18 +5,20 @@ # disruption = low {{%- if RECURSIVE %}} -{{%- set FIND_RECURSE_ARGS="" %}} +{{%- set FIND_RECURSE_ARGS_DEP="" %}} +{{%- set FIND_RECURSE_ARGS_SYM="" %}} {{%- else %}} -{{%- set FIND_RECURSE_ARGS="-maxdepth 1 -L" %}} +{{%- set FIND_RECURSE_ARGS_DEP="-maxdepth 1" %}} +{{%- set FIND_RECURSE_ARGS_SYM="-L" %}} {{%- endif %}} {{%- for path in FILEPATH %}} {{%- if IS_DIRECTORY %}} {{%- if FILE_REGEX %}} -find {{{ path }}} {{{ FIND_RECURSE_ARGS }}} -type f ! -group {{{ GID_OR_NAME }}} -regextype posix-extended -regex '{{{ FILE_REGEX[loop.index0] }}}' -exec chgrp -L {{{ GID_OR_NAME }}} {} \; +find {{{ FIND_RECURSE_ARGS_SYM }}} {{{ path }}} {{{ FIND_RECURSE_ARGS_DEP }}} -type f ! -group {{{ GID_OR_NAME }}} -regextype posix-extended -regex '{{{ FILE_REGEX[loop.index0] }}}' -exec chgrp -L {{{ GID_OR_NAME }}} {} \; {{%- else %}} -find -H {{{ path }}} {{{ FIND_RECURSE_ARGS }}} -type d -exec chgrp -L {{{ GID_OR_NAME }}} {} \; +find -H {{{ path }}} {{{ FIND_RECURSE_ARGS_DEP }}} -type d -exec chgrp -L {{{ GID_OR_NAME }}} {} \; {{%- endif %}} {{%- else %}} chgrp {{{ GID_OR_NAME }}} {{{ path }}} diff --git a/shared/templates/file_permissions/bash.template b/shared/templates/file_permissions/bash.template index 946c8545236..290b16214b6 100644 --- a/shared/templates/file_permissions/bash.template +++ b/shared/templates/file_permissions/bash.template @@ -5,9 +5,11 @@ # disruption = low {{%- if RECURSIVE %}} -{{% set FIND_RECURSE_ARGS="" %}} +{{%- set FIND_RECURSE_ARGS_DEP="" %}} +{{%- set FIND_RECURSE_ARGS_SYM="" %}} {{%- else %}} -{{% set FIND_RECURSE_ARGS="-maxdepth 1" %}} +{{%- set FIND_RECURSE_ARGS_DEP="-maxdepth 1" %}} +{{%- set FIND_RECURSE_ARGS_SYM="-L" %}} {{%- endif %}} {{%- if ALLOW_STRICTER_PERMISSIONS %}} @@ -25,9 +27,9 @@ {{% for path in FILEPATH %}} {{%- if IS_DIRECTORY %}} {{%- if FILE_REGEX %}} -find -H {{{ path }}} {{{ FIND_RECURSE_ARGS }}} {{{ PERMS }}} {{{ EXCLUDED_FILES_ARGS }}} -type f -regextype posix-extended -regex '{{{ FILE_REGEX[loop.index0] }}}' -exec chmod {{{ FILEMODE }}} {} \; +find {{{ FIND_RECURSE_ARGS_SYM }}} {{{ path }}} {{{ FIND_RECURSE_ARGS_DEP }}} {{{ PERMS }}} {{{ EXCLUDED_FILES_ARGS }}} -type f -regextype posix-extended -regex '{{{ FILE_REGEX[loop.index0] }}}' -exec chmod {{{ FILEMODE }}} {} \; {{%- else %}} -find -H {{{ path }}} {{{ FIND_RECURSE_ARGS }}} {{{ PERMS }}} -type d -exec chmod {{{ FILEMODE }}} {} \; +find -H {{{ path }}} {{{ FIND_RECURSE_ARGS_DEP }}} {{{ PERMS }}} -type d -exec chmod {{{ FILEMODE }}} {} \; {{%- endif %}} {{%- else %}} chmod {{{ FILEMODE }}} {{{ path }}}