This commit is contained in:
committer
2024-05-15 07:30:46 -05:00
parent 2947a8a4df
commit 06e9a26563

View File

@@ -60,6 +60,7 @@ deploy_file() {
_src_path=$1
_trg_path=$2
_no_chown=$3
_recursive=$4
file_name=$(basename ${_trg_path})
echo ""
@@ -69,14 +70,22 @@ deploy_file() {
cp --force --recursive ${_src_path} ${_trg_path}
# only chown if _no_chown variable is empty
if [ -z "${_no_chown}" ]; then
if [[ ${_no_chown} != "no_chown" ]] ; then
# if the target path ends with a slash, we have a directory
if [[ "$_trg_path" == */ ]]
then
echo "(ignore potential \"chown: cannot access\" error, which will occur if there are no dot-files in the directory)"
chown ${user}:${user} ${_trg_path}*
# https://serverfault.com/questions/156437/how-to-chown-a-directory-recursively-including-hidden-files-or-directories
chown ${user}:${user} ${_trg_path}.[^.]*
if [[ ${_recursive} != "recursive" ]] ; then
echo "one"
#chown ${user}:${user} ${_trg_path}*
# https://serverfault.com/questions/156437/how-to-chown-a-directory-recursively-including-hidden-files-or-directories
#chown ${user}:${user} ${_trg_path}.[^.]*
else
echo "recursive"
# chown -R ${user}:${user} ${_trg_path}*
# chown -R ${user}:${user} ${_trg_path}.[^.]*
fi
else
chown ${user}:${user} ${_trg_path}
fi