Update libexec/ scripts

This commit is contained in:
0x1eef 2024-04-03 12:49:53 -03:00
parent b2a81cd6cf
commit 9d932201d6
5 changed files with 27 additions and 12 deletions

View file

@ -2,7 +2,7 @@
set -e set -e
## ##
# Variables # variables
rootdir=$(dirname "$0") rootdir=$(dirname "$0")
gitdir="/home/_portzap/ports" gitdir="/home/_portzap/ports"
giturl="${PORTZAP_GITURL:-https://git.hardenedbsd.org/hardenedbsd/ports.git}" giturl="${PORTZAP_GITURL:-https://git.hardenedbsd.org/hardenedbsd/ports.git}"
@ -11,7 +11,7 @@ revision="${installdir}/.portzap"
libexec=$(realpath "${rootdir}/../libexec/portzap") libexec=$(realpath "${rootdir}/../libexec/portzap")
## ##
# Functions # functions
require_root() { require_root() {
if [ "$(id -u)" != "0" ]; then if [ "$(id -u)" != "0" ]; then
echo "This command requires root privileges." echo "This command requires root privileges."

View file

@ -1,9 +1,10 @@
#!/bin/sh #!/bin/sh -e
set -e
##
# main
pw useradd -n _portzap \ pw useradd -n _portzap \
-c "portzap user" \ -c "portzap user" \
-m \ -m \
-M "u=rwX,g=rwX,o=" \
-s /sbin/nologin -s /sbin/nologin
chmod -R u=rwX,g=rwX,o= /home/_portzap/ chmod -R u=rwX,g=rwX,o= /home/_portzap/
echo "/home/_portzap/ has been created." echo OK

View file

@ -1,7 +1,12 @@
#!/bin/sh #!/bin/sh -e
set -ex
##
# variables
giturl=$1 giturl=$1
gitdir=$2 gitdir=$2
##
# main
if [ -e "${gitdir}/.git" ]; then if [ -e "${gitdir}/.git" ]; then
echo "${gitdir} already exists." echo "${gitdir} already exists."
echo "Try 'portzap pull' instead." echo "Try 'portzap pull' instead."

View file

@ -1,9 +1,13 @@
#!/bin/sh #!/bin/sh -e
set -ex
##
# variables
gitdir=$1 gitdir=$1
installdir=$2 installdir=$2
excludes=".git .gitignore .hooks .arcconfig" excludes=".git .gitignore .hooks .arcconfig"
##
# main
cd "${gitdir}" cd "${gitdir}"
find -s . -maxdepth 1 \ find -s . -maxdepth 1 \
-exec cp -Rfv {} "${installdir}" \; \ -exec cp -Rfv {} "${installdir}" \; \

View file

@ -1,6 +1,11 @@
#!/bin/sh #!/bin/sh -e
set -ex
##
# variables
gitdir=$1 gitdir=$1
##
# main
umask u=rwX,g=rwX,o= umask u=rwX,g=rwX,o=
if [ -e "${gitdir}/.git" ]; then if [ -e "${gitdir}/.git" ]; then
cd "${gitdir}" cd "${gitdir}"