git: 0a0dd568d8ab - main - security/easy-rsa: fix confusion of vars file

From: Matthias Andree <mandree_at_FreeBSD.org>
Date: Thu, 02 Jun 2022 21:31:11 UTC
The branch main has been updated by mandree:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0a0dd568d8ab0a5598b7d0ccc6d560102418f512

commit 0a0dd568d8ab0a5598b7d0ccc6d560102418f512
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2022-06-02 21:26:24 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2022-06-02 21:29:43 +0000

    security/easy-rsa: fix confusion of vars file
    
    ...and no longer package it as @sample. It is per-PKI, and easyrsa init-pki
    will copy vars.example from the distribution, and create a PKI-local copy
    named vars.  Should fix grembo@'s bug report [1]
    
    add a new pkg-message file to explain this.
    
    while here, add a convenience hardlink easy-rsa to the easyrsa wrapper,
    to have an executable matching the package name.
    
    PR:             264415
    Reported by:    grembo@ (Michael Gmelin)
---
 security/easy-rsa/Makefile    |  2 ++
 security/easy-rsa/pkg-message | 15 +++++++++++++++
 security/easy-rsa/pkg-plist   |  3 ++-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/security/easy-rsa/Makefile b/security/easy-rsa/Makefile
index b1a0304f579e..7cbe849e9b68 100644
--- a/security/easy-rsa/Makefile
+++ b/security/easy-rsa/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	easy-rsa
 DISTVERSION=	3.1.0
+PORTREVISION=	1
 CATEGORIES=	security net-mgmt
 MASTER_SITES=	https://github.com/OpenVPN/easy-rsa/releases/download/v${DISTVERSION}/
 DISTNAME=	EasyRSA-${DISTVERSION}
@@ -33,6 +34,7 @@ do-install:
 		${MKDIR} ${STAGEDIR}${PREFIX}/bin
 		${MKDIR} ${STAGEDIR}${DATADIR}/x509-types/
 		${INSTALL_SCRIPT} ${WRKDIR}/easyrsa ${STAGEDIR}${PREFIX}/bin/
+		${LN} -fh ${STAGEDIR}${PREFIX}/bin/easyrsa ${STAGEDIR}${PREFIX}/bin/easy-rsa
 		${INSTALL_SCRIPT} ${WRKSRC}/easyrsa ${STAGEDIR}${DATADIR}/easyrsa.real
 		${INSTALL_DATA} ${WRKSRC}/vars.example ${STAGEDIR}${DATADIR}/
 		${INSTALL_DATA} ${WRKSRC}/openssl-easyrsa.cnf ${STAGEDIR}${DATADIR}/openssl-easyrsa.cnf.example
diff --git a/security/easy-rsa/pkg-message b/security/easy-rsa/pkg-message
new file mode 100644
index 000000000000..64008e57eb92
--- /dev/null
+++ b/security/easy-rsa/pkg-message
@@ -0,0 +1,15 @@
+NOTE: easy-rsa will require you to initialize a pki ONLY UPON FIRST USE.
+The packaging itself no longer does this because that would confuse easy-rsa,
+and easy-rsa expects the vars not to be per-installation, but per-PKI.
+
+ONLY for the very first run for a new PKI, do something such as:
+
+  easyrsa --pki-dir=~/my_new_pki init-pki # DANGEROUS - DESTROYS ~/my_new_pki
+  which will copy vars.example both into ~/my_new_pki
+  and create another copy named ~/my/new_pki/vars for you to edit for this PKI.
+
+  Then, edit ~/my/new_pki/vars to set the defaults.
+
+After upgrades, use other commands, explained by running: easyrsa help.
+to explain options such as --pki-dir (see above), run: easyrsa help options
+
diff --git a/security/easy-rsa/pkg-plist b/security/easy-rsa/pkg-plist
index a98f2b0dcdf6..af2c06e18188 100644
--- a/security/easy-rsa/pkg-plist
+++ b/security/easy-rsa/pkg-plist
@@ -1,4 +1,5 @@
 bin/easyrsa
+bin/easy-rsa
 %%DATADIR%%/easyrsa.real
 @sample %%DATADIR%%/openssl-easyrsa.cnf.example %%DATADIR%%/openssl-easyrsa.cnf
-@sample %%DATADIR%%/vars.example %%DATADIR%%/vars
+%%DATADIR%%/vars.example