From ec01b20506e96f7cb8aeae4a6e670fc159e894cd Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Sun, 14 Apr 2024 20:32:48 -0300 Subject: [PATCH] Replace multiple commands with `/usr/bin/install` --- libexec/portzap/portzap-install | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/libexec/portzap/portzap-install b/libexec/portzap/portzap-install index 5e54bc6..7529686 100755 --- a/libexec/portzap/portzap-install +++ b/libexec/portzap/portzap-install @@ -6,8 +6,9 @@ gitdir=$1 installdir=$2 revfile=$3 artifacts=".git .gitignore .hooks .arcconfig" -libexec=/usr/local/libexec/portzap +libexec="/usr/local/libexec/portzap" mode="u=rwX,g=rwX,o=" +flags="-o root -g _portzap -m ${mode} -v" ## # functions @@ -28,21 +29,14 @@ perform_update() target="${installdir}/${file}" parent=$(dirname "${target}") if [ ! -e "${parent}" ]; then - mkdir -p "${parent}" - chown root:_portzap "${parent}" - chmod ${mode} "${parent}" + install -d ${flags} "${parent}" fi - cp -v "${file}" "${target}" - chown root:_portzap "${target}" - chmod ${mode} "${target}" + install ${flags} "${file}" "${target}" done } perform_install() { - mkdir -p "${installdir}" - chown root:_portzap "${installdir}" - chmod ${mode} "${installdir}" find -s . \ -maxdepth 1 \ -exec cp -Rfv {} "${installdir}" \; \ @@ -56,6 +50,7 @@ perform_install() ## # main cd "${gitdir}" +install -d ${flags} "${installdir}" if [ -e "${revfile}" ]; then perform_update else