Walk tree when a new directory is installed

Each directory is created separately, from the first directory
that doesn't exist to the last.
This commit is contained in:
0x1eef 2024-04-18 15:54:59 -03:00
parent e6a79a5111
commit ea31863354

View file

@ -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
}