Add libexec/portzap/install-directory

This commit is contained in:
0x1eef 2023-01-20 11:06:19 -03:00
parent 20f379d11e
commit 0f08f82e6a
3 changed files with 14 additions and 6 deletions

View file

@ -8,6 +8,7 @@ source_url="https://git.hardenedbsd.org/hardenedbsd/ports.git"
transient_dir="/home/_portzap/ports"
rest_dir="/usr/ports/"
libexec_dir=$(realpath $(dirname $0)/../libexec/portzap/)
group="_portzap"
##
# Default masks
@ -17,7 +18,7 @@ pull_mask=007
##
# Default modes
install_mode="u=rwX,g=rX,o=rX"
install_mode="u=rwX,g=rX,o="
##
# Utils
@ -108,9 +109,9 @@ install() {
exit 1
fi
cd $transient_dir
find . -maxdepth 1 -type f -exec install -m $install_mode {} $rest_dir \;
find . -maxdepth 1 -type d -exec mkdir -p -m $install_mode $rest_dir/{} \;
find . -depth 2 -type d -exec $libexec_dir/install-port {} $rest_dir $install_mode \;
find . -maxdepth 1 -type f -exec install -g $group -m $install_mode {} $rest_dir \;
find . -maxdepth 1 -type d -exec $libexec_dir/install-directory {} $rest_dir/{} \;
find . -depth 2 -type d -exec $libexec_dir/install-port {} $rest_dir $install_mode $libexec_dir \;
}
case $1 in

View file

@ -0,0 +1,6 @@
#!/bin/sh
src=$1
dest=$2
group=_portzap
mode=u=rwx,g=rx,o=
install -d -g $group -m $mode $src $dest

View file

@ -2,14 +2,15 @@
src=$1
dest=$2/${src}
mode=$3
libexec_dir=$4
group=_portzap
install_args="-m $mode"
mkdir -m $mode -p $dest
$libexec_dir/install-directory $src $dest
find $src -maxdepth 1 -type f -execdir install $install_args {} $dest/{} \;
if [ -d "$src/files" ];
then
mkdir -m $mode -p $dest/files
$libexec_dir/install-directory $src/files $dest/files
find $src/files -maxdepth 1 -type f -execdir install $install_args {} $dest/files \;
fi
echo Install $(realpath $dest)