0x1eef
bc5ddd2141
This change introduces an environment variable that can point to an alternative git repository (eg GitHub) if the default is offline.
43 lines
1 KiB
Bash
Executable file
43 lines
1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
|
|
# Variables
|
|
base_dir=$(dirname "$0")
|
|
ports_url="${PORTZAP_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 "$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"
|
|
|
|
# Functions
|
|
. "$libexec_dir/functions/requirements.sh"
|
|
|
|
case $1 in
|
|
"clone")
|
|
require_deps git
|
|
require_group _portzap
|
|
portzap_clone "$portzap_dir" "$ports_url" "$clone_mask"
|
|
;;
|
|
"pull")
|
|
require_deps git
|
|
require_group _portzap
|
|
portzap_pull "$portzap_dir" "$pull_mask"
|
|
;;
|
|
"install")
|
|
require_root
|
|
require_deps git
|
|
portzap_install "$ports_dir" "$portzap_dir" "$libexec_dir" "$portzap_file"
|
|
;;
|
|
*)
|
|
echo "Usage: portzap clone|pull|install"
|
|
;;
|
|
esac
|