From bd4292f6ca56d24fcf8b3a770587e42add243bdd Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Mon, 29 May 2023 00:56:54 -0300 Subject: [PATCH] Fix shellcheck (./bin/portzap), and add `.shellcheckrc` --- .shellcheckrc | 5 +++++ bin/portzap | 17 +++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 .shellcheckrc diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 0000000..a2094e9 --- /dev/null +++ b/.shellcheckrc @@ -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 diff --git a/bin/portzap b/bin/portzap index 2ae38b4..a6d6d30 100755 --- a/bin/portzap +++ b/bin/portzap @@ -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"