Fix shellcheck (./bin/portzap), and add .shellcheckrc

This commit is contained in:
0x1eef 2023-05-29 00:56:54 -03:00
parent e87c6c5867
commit bd4292f6ca
2 changed files with 14 additions and 8 deletions

5
.shellcheckrc Normal file
View file

@ -0,0 +1,5 @@
external-sources=true
source=./libexec/portzap/commands/portzap-install
source=./libexec/portzap/commands/portzap-pull
source=./libexec/portzap/commands/portzap-clone
source=./libexec/portzap/functions/requirements.sh

View file

@ -1,39 +1,40 @@
#!/bin/sh
# Variables
base_dir=$(dirname "$0")
ports_url="https://git.hardenedbsd.org/hardenedbsd/ports.git"
ports_dir="/usr/ports/"
portzap_file="$ports_dir/.portzap"
portzap_dir="/home/_portzap/ports"
libexec_dir=$(realpath $(dirname $0)/../libexec/portzap/)
libexec_dir=$(realpath "$base_dir/../libexec/portzap/")
# Masks
clone_mask=007
pull_mask=007
# Commands
. $libexec_dir/commands/portzap-install
. $libexec_dir/commands/portzap-pull
. $libexec_dir/commands/portzap-clone
. "$libexec_dir/commands/portzap-install"
. "$libexec_dir/commands/portzap-pull"
. "$libexec_dir/commands/portzap-clone"
# Functions
. $libexec_dir/functions/requirements.sh
. "$libexec_dir/functions/requirements.sh"
case $1 in
"clone")
require_deps git
require_group _portzap
portzap_clone $portzap_dir $ports_url $clone_mask
portzap_clone "$portzap_dir" "$ports_url" "$clone_mask"
;;
"pull")
require_deps git
require_group _portzap
portzap_pull $portzap_dir $pull_mask
portzap_pull "$portzap_dir" "$pull_mask"
;;
"install")
require_root
require_deps git
portzap_install $ports_dir $portzap_dir $libexec_dir $portzap_file
portzap_install "$ports_dir" "$portzap_dir" "$libexec_dir" "$portzap_file"
;;
*)
echo "Usage: portzap clone|pull|install"