diff --git a/bin/portzap b/bin/portzap index 0d78618..60fcbc6 100755 --- a/bin/portzap +++ b/bin/portzap @@ -2,7 +2,7 @@ set -e ## -# Variables +# variables rootdir=$(dirname "$0") gitdir="/home/_portzap/ports" giturl="${PORTZAP_GITURL:-https://git.hardenedbsd.org/hardenedbsd/ports.git}" @@ -11,7 +11,7 @@ revision="${installdir}/.portzap" libexec=$(realpath "${rootdir}/../libexec/portzap") ## -# Functions +# functions require_root() { if [ "$(id -u)" != "0" ]; then echo "This command requires root privileges." diff --git a/libexec/portzap/portzap-adduser b/libexec/portzap/portzap-adduser index 0ac7104..f48ba91 100755 --- a/libexec/portzap/portzap-adduser +++ b/libexec/portzap/portzap-adduser @@ -1,9 +1,10 @@ -#!/bin/sh -set -e +#!/bin/sh -e + +## +# main pw useradd -n _portzap \ -c "portzap user" \ -m \ - -M "u=rwX,g=rwX,o=" \ -s /sbin/nologin chmod -R u=rwX,g=rwX,o= /home/_portzap/ -echo "/home/_portzap/ has been created." +echo OK diff --git a/libexec/portzap/portzap-clone b/libexec/portzap/portzap-clone index 5617b2b..e5cb317 100755 --- a/libexec/portzap/portzap-clone +++ b/libexec/portzap/portzap-clone @@ -1,7 +1,12 @@ -#!/bin/sh -set -ex +#!/bin/sh -e + +## +# variables giturl=$1 gitdir=$2 + +## +# main if [ -e "${gitdir}/.git" ]; then echo "${gitdir} already exists." echo "Try 'portzap pull' instead." diff --git a/libexec/portzap/portzap-install b/libexec/portzap/portzap-install index 6c504ce..23d5b42 100755 --- a/libexec/portzap/portzap-install +++ b/libexec/portzap/portzap-install @@ -1,9 +1,13 @@ -#!/bin/sh -set -ex +#!/bin/sh -e + +## +# variables gitdir=$1 installdir=$2 excludes=".git .gitignore .hooks .arcconfig" +## +# main cd "${gitdir}" find -s . -maxdepth 1 \ -exec cp -Rfv {} "${installdir}" \; \ diff --git a/libexec/portzap/portzap-pull b/libexec/portzap/portzap-pull index 492edba..da59930 100755 --- a/libexec/portzap/portzap-pull +++ b/libexec/portzap/portzap-pull @@ -1,6 +1,11 @@ -#!/bin/sh -set -ex +#!/bin/sh -e + +## +# variables gitdir=$1 + +## +# main umask u=rwX,g=rwX,o= if [ -e "${gitdir}/.git" ]; then cd "${gitdir}"