In some cases the check_dirs_mkdir() function will create directories on the way (parents) with insufficient rights. Therefore the chmod/chown later on will fail due to missing rights.
This patch forces 'umask 0022' for creating the directories on the way and additionally add the missing '-m755' switch to the 'sudo'-variant. Signed-off-by: Andreas Bießmann <[email protected]> --- bin/ptxdist | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ptxdist b/bin/ptxdist index 52e9c76..74a5a23 100755 --- a/bin/ptxdist +++ b/bin/ptxdist @@ -398,7 +398,7 @@ check_dirs_mkdir() { # create dir if not exiting if [ ! -d "${dir}" ]; then - if ! mkdir -m755 -p -- "${dir}" 2> /dev/null; then + if ! (umask 0022 && mkdir -m755 -p -- "${dir}") 2> /dev/null; then echo echo "error: '${dir}'" echo " does not exist and cannot be created!" @@ -410,8 +410,8 @@ check_dirs_mkdir() { exit 1 fi echo - echo sudo mkdir -p "${dir}" - sudo mkdir -p "${dir}" + echo "umask 0022 && sudo mkdir -m755 -p \"${dir}\"" + (umask 0022 && sudo mkdir -m755 -p "${dir}") echo sudo chown "${UID}" "${dir}" sudo chown "${UID}" "${dir}" fi -- 1.7.8.3 -- ptxdist mailing list [email protected]
