From ea31863354ad6876b80e087c58807d7b3c69e9f7 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Thu, 18 Apr 2024 15:54:59 -0300 Subject: [PATCH] Walk tree when a new directory is installed Each directory is created separately, from the first directory that doesn't exist to the last. --- libexec/portzap/portzap-install | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libexec/portzap/portzap-install b/libexec/portzap/portzap-install index ccdff1d..06e6757 100755 --- a/libexec/portzap/portzap-install +++ b/libexec/portzap/portzap-install @@ -25,9 +25,14 @@ perform_update() for file in ${add}; do target="${installdir}/${file}" parent=$(dirname "${target}") - if [ ! -e "${parent}" ]; then - run_install "-d" "-m" "u=rwx,g=rwx,o=" "${parent}" - fi + parents="" + while [ ! -e "${parent}" ]; do + parents="${parent} ${parents}" + parent=$(dirname "${parent}") + done + for dir in ${parents}; do + run_install "-d" "-m" "u=rwx,g=rwx,o=" "${dir}" + done run_install "-m" "u=rw,g=rw,o=" "${file}" "${target}" done }