git: 842f5b3996e5 - main - net/nepenthes: modernize

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Thu, 25 May 2023 07:08:30 UTC
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=842f5b3996e5a9a5e666b4fc28ff75a973b97edd

commit 842f5b3996e5a9a5e666b4fc28ff75a973b97edd
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2023-05-25 07:06:14 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2023-05-25 07:08:18 +0000

    net/nepenthes: modernize
    
    Remove all usage of pkg-install and pkg-deinstall which can be done via
    keywords.
    This makes this port ROOTDIR friendly
---
 net/nepenthes/Makefile      |  9 ++++++++-
 net/nepenthes/pkg-deinstall | 46 ---------------------------------------------
 net/nepenthes/pkg-install   | 46 ---------------------------------------------
 net/nepenthes/pkg-plist     | 11 ++++++++++-
 4 files changed, 18 insertions(+), 94 deletions(-)

diff --git a/net/nepenthes/Makefile b/net/nepenthes/Makefile
index 083ab5f9a09e..796364d8734b 100644
--- a/net/nepenthes/Makefile
+++ b/net/nepenthes/Makefile
@@ -44,7 +44,14 @@ post-patch:
 		 s|-R/usr/local/lib||' ${WRKSRC}/configure
 
 post-install:
-	@${MKDIR} ${STAGEDIR}${DATADIR}/signatures
+	@${MKDIR} ${STAGEDIR}${DATADIR}/signatures \
+		${STAGEDIR}/var/binaries \
+		${STAGEDIR}/var/hexdumps \
+		${STAGEDIR}/var/log/pcap \
+		${STAGEDIR}/var/spool/nepenthes/gotek \
+		${STAGEDIR}/var/spool/nepenthes/submitpostgres \
+		${STAGEDIR}/var/cache/nepenthes/pcap \
+		${STAGEDIR}/var/cache/nepenthes/signatures
 	(cd ${WRKSRC}/modules/shellcode-signatures && ${INSTALL_DATA} \
 		shellcode-signatures.sc ${STAGEDIR}${DATADIR}/signatures)
 
diff --git a/net/nepenthes/pkg-deinstall b/net/nepenthes/pkg-deinstall
deleted file mode 100644
index 671f2981d6f0..000000000000
--- a/net/nepenthes/pkg-deinstall
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-
-if [ "$2" != "DEINSTALL" ]; then
-   exit 0
-fi
-
-if cmp -s ${PKG_PREFIX}/share/nepenthes/signatures/shellcode-signatures.sc \
-   /var/cache/nepenthes/signatures/shellcode-signatures.sc; then
-   rm -f /var/cache/nepenthes/signatures/shellcode-signatures.sc
-fi
-
-if [ -d /var/spool/nepenthes/submitpostgres ]; then
-   rmdir /var/spool/nepenthes/submitpostgres 2>/dev/null || true
-fi
-
-if [ -d /var/spool/nepenthes/gotek ]; then
-   rmdir /var/spool/nepenthes/gotek 2>/dev/null || true
-fi
-
-if [ -d /var/spool/nepenthes ]; then
-   rmdir /var/spool/nepenthes 2>/dev/null || true
-fi
-
-if [ -d /var/log/pcap ]; then
-   rmdir /var/log/pcap 2>/dev/null || true
-fi
-
-if [ -d /var/hexdumps ]; then
-   rmdir /var/hexdumps 2>/dev/null || true
-fi
-
-if [ -d /var/cache/nepenthes/signatures ]; then
-   rmdir /var/cache/nepenthes/signatures 2>/dev/null || true
-fi
-
-if [ -d /var/cache/nepenthes/pcap ]; then
-   rmdir /var/cache/nepenthes/pcap 2>/dev/null || true
-fi
-
-if [ -d /var/cache/nepenthes ]; then
-   rmdir /var/cache/nepenthes 2>/dev/null || true
-fi
-
-if [ -d /var/binaries ]; then
-   rmdir /var/binaries 2>/dev/null || true
-fi
diff --git a/net/nepenthes/pkg-install b/net/nepenthes/pkg-install
deleted file mode 100644
index c62009d06b67..000000000000
--- a/net/nepenthes/pkg-install
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-
-if [ "$2" != "POST-INSTALL" ]; then
-   exit 0
-fi
-
-if [ ! -d /var/binaries ]; then
-   install -d /var/binaries
-fi
-
-if [ ! -d /var/cache/nepenthes ]; then
-   install -d /var/cache/nepenthes
-fi
-
-if [ ! -d /var/cache/nepenthes/pcap ]; then
-   install -d /var/cache/nepenthes/pcap
-fi
-
-if [ ! -d /var/cache/nepenthes/signatures ]; then
-   install -d /var/cache/nepenthes/signatures
-fi
-
-if [ ! -d /var/hexdumps ]; then
-   install -d /var/hexdumps
-fi
-
-if [ ! -d /var/log/pcap ]; then
-   install -d /var/log/pcap
-fi
-
-if [ ! -d /var/binaries ]; then
-   install -d /var/spool/nepenthes
-fi
-
-if [ ! -d /var/binaries ]; then
-   install -d /var/spool/nepenthes/gotek
-fi
-
-if [ ! -d /var/binaries ]; then
-   install -d /var/spool/nepenthes/submitpostgres
-fi
-
-if [ ! -f /var/cache/nepenthes/signatures/shellcode-signatures.sc ]; then
-   install -c ${PKG_PREFIX}/share/nepenthes/signatures/shellcode-signatures.sc \
-           /var/cache/nepenthes/signatures
-fi
diff --git a/net/nepenthes/pkg-plist b/net/nepenthes/pkg-plist
index 243f93b5a1c1..98f1afd47d38 100644
--- a/net/nepenthes/pkg-plist
+++ b/net/nepenthes/pkg-plist
@@ -163,4 +163,13 @@ man/man8/nepenthes.8.gz
 %%DATADIR%%/README
 %%DATADIR%%/README.VFS
 %%DATADIR%%/logo-shaded.svg
-%%DATADIR%%/signatures/shellcode-signatures.sc
+@sample %%DATADIR%%/signatures/shellcode-signatures.sc /var/cache/nepenthes/signatures/shellcode-signatures.sc
+@dir /var/binaries
+@dir /var/cache/nepenthes/
+@dir /var/cache/nepenthes/pcap
+@dir /var/cache/nepenthes/signatures
+@dir /var/hexdumps
+@dir /var/log/pcap
+@dir /var/spool/nepenthes/
+@dir /var/spool/nepenthes/gotek
+@dir /var/spool/nepenthes/submitpostgres