From 1249f3c3546ef76a090ecacbe3558a7611272c0f Mon Sep 17 00:00:00 2001
From: 0x1eef <0x1eef@protonmail.com>
Date: Fri, 9 Jun 2023 22:04:38 -0300
Subject: [PATCH] Add $PORTZAP_PORTS_DIR
---
README.md | 4 ++++
bin/portzap | 2 +-
man/man8/portzap.8 | 6 +++++-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 1385008..863142d 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,10 @@ portzap is a utility that manages a local copy of the
# Defaults to "/usr/ports/"
export PORTZAP_PORTS_DIR=/path/to/ports
+* __$PORTZAP_PORTS_DIR__
+ The directory where the ports collection will be installed.
+ Defaults to /usr/ports.
+
## Install
```
diff --git a/bin/portzap b/bin/portzap
index 439ad4f..1ca0a20 100755
--- a/bin/portzap
+++ b/bin/portzap
@@ -4,7 +4,7 @@
# Variables
base_dir=$(dirname "$0")
ports_url="${PORTZAP_PORTS_URL:-https://git.hardenedbsd.org/hardenedbsd/ports.git}"
-ports_dir="/usr/ports/"
+ports_dir="${PORTZAP_PORTS_DIR:-/usr/ports/}"
portzap_file="$ports_dir/.portzap"
portzap_dir="/home/_portzap/ports"
libexec_dir=$(realpath "$base_dir/../libexec/portzap/")
diff --git a/man/man8/portzap.8 b/man/man8/portzap.8
index 8a09082..d939d54 100644
--- a/man/man8/portzap.8
+++ b/man/man8/portzap.8
@@ -47,8 +47,12 @@ The following variables can be used:
.It Ev PORTZAP_PORTS_URL
The URL to a git repository.
Defaults to https://git.hardenedbsd.org/hardenedbsd/ports.git.
+.It Ev PORTZAP_PORTS_DIR
+The directory where the ports collection will be installed.
+Defaults to
+.Pa /usr/ports.
.Sh AUTHORS
The
.Nm portzap
utility and this manual page were written by
-0x1eef <0x1eef@protonmail.com> .
+0x1eef <0x1eef@protonmail.com>.