git: 3109e75af713 - main - comms/smstools3: Clean up and modernize port

From: Guido Falsi <madpilot_at_FreeBSD.org>
Date: Wed, 27 Jul 2022 20:31:01 UTC
The branch main has been updated by madpilot:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3109e75af713dfba3e429ee56d688e4a18141279

commit 3109e75af713dfba3e429ee56d688e4a18141279
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2022-07-27 20:29:54 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2022-07-27 20:30:53 +0000

    comms/smstools3: Clean up and modernize port
    
    - Remove unneeded pkg-install/pkg-deinstall scripts, and properly
      use pkg-message to display uninstall message [1]
    - Reorder some statements to silence some portlint warnings
    - Properly use shebangfix on more files, replacing some REINPLACE_CMDs
    - Remove unneeded REINPLACE_CMDs
    - Use RLN in place of LN, to correctly create relative symlinks
    
    Reported by:    bapt [1]
---
 comms/smstools3/Makefile               | 30 +++++++++++++++++-------------
 comms/smstools3/files/pkg-deinstall.in | 14 --------------
 comms/smstools3/files/pkg-install.in   |  8 --------
 comms/smstools3/files/pkg-message.in   | 11 +++++++++++
 4 files changed, 28 insertions(+), 35 deletions(-)

diff --git a/comms/smstools3/Makefile b/comms/smstools3/Makefile
index aada16563a54..6461fbc67ef3 100644
--- a/comms/smstools3/Makefile
+++ b/comms/smstools3/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	smstools
 PORTVERSION=	3.1.21
+PORTREVISION=	1
 CATEGORIES=	comms
 MASTER_SITES=	http://smstools3.kekekasvi.com/packages/
 DISTNAME=	smstools3-${PORTVERSION}
@@ -12,16 +13,18 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 
 LIB_DEPENDS=	libinotify.so:devel/libinotify
 
+USES=		gmake localbase:ldflags shebangfix
 CONFLICTS_INSTALL=	gnokii sendsms # bin/sendsms
-
-OPTIONS_DEFINE=	STATS UTF8 EXAMPLES DOCS
-OPTIONS_DEFAULT=	STATS UTF8
-STATS_DESC=	Build status and statistics support
-
 WRKSRC=		${WRKDIR}/smstools3
-
-USES=		gmake localbase:ldflags shebangfix
-SHEBANG_FILES=	scripts/hex2dec scripts/hex2bin
+SHEBANG_FILES=	scripts/eventhandler_report \
+		scripts/hex2bin \
+		scripts/hex2dec \
+		scripts/load_balancing.sh \
+		scripts/regular_run \
+		scripts/sendsms \
+		scripts/sms2html \
+		scripts/sms2unicode \
+		scripts/unicode2sms
 SHEBANG_LANG=	awk
 awk_OLD_CMD=	/bin/gawk
 awk_CMD=	${LOCALBASE}/bin/awk
@@ -35,7 +38,7 @@ SUB_LIST+=	SPOOLDIR="${SPOOLDIR}" LOGDIR="${LOGDIR}" PIDDIR="${PIDDIR}" \
 		SMSD_USER="${SMSD_USER}" SMSD_GROUP="${SMSD_GROUP}"
 PLIST_SUB+=	SPOOLDIR="${SPOOLDIR}" LOGDIR="${LOGDIR}" PIDDIR="${PIDDIR}" \
 		SMSD_USER="${SMSD_USER}" SMSD_GROUP="${SMSD_GROUP}"
-SUB_FILES=	pkg-install pkg-deinstall
+SUB_FILES=	pkg-message
 
 CFLAGS+=	-fcommon
 LDFLAGS+=	-linotify
@@ -43,6 +46,10 @@ LDFLAGS+=	-linotify
 PORTDOCS=	*
 PORTEXAMPLES=	.procmailrc .qmailrc *
 
+OPTIONS_DEFINE=	STATS UTF8 EXAMPLES DOCS
+OPTIONS_DEFAULT=	STATS UTF8
+
+STATS_DESC=	Build status and statistics support
 STATS_LIB_DEPENDS=	libmm.so:devel/mm
 STATS_CFLAGS_OFF=	-DNOSTATS
 
@@ -56,15 +63,12 @@ post-patch:
 	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
 			-e 's|%%STAGEDIR%%|${STAGEDIR}|g' \
 		${WRKSRC}/Makefile ${WRKSRC}/install.sh ${WRKSRC}/src/smsd_cfg.h
-	@${REINPLACE_CMD} -e 's,^override,\toverride,g' ${WRKSRC}/src/Makefile
 	@${REINPLACE_CMD} -e 's|/dev/ttyS0|${SMSTOOLS_DEFAULT_COMPORT}|g' \
 			-e 's|%%SMSD_USER%%|${SMSD_USER}|' \
 			-e 's|%%SMSD_GROUP%%|${SMSD_GROUP}|' \
 		${WRKSRC}/examples/smsd.conf.easy \
 		${WRKSRC}/examples/smsd.conf.full \
 		${WRKSRC}/examples/smsd.conf.non-root
-	@${REINPLACE_CMD} 's|/bin/bash|/bin/sh|g' \
-		${WRKSRC}/scripts/*
 
 post-install:
 	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/smsd
@@ -73,7 +77,7 @@ post-install:
 		${INSTALL_SCRIPT} $$file ${STAGEDIR}${DATADIR}/; \
 	done
 .for FILE in sendsms sms2html sms2unicode unicode2sms
-	${LN} -sf ${DATADIR}/${FILE} ${STAGEDIR}${PREFIX}/bin/${FILE}
+	${RLN} ${STAGEDIR}${DATADIR}/${FILE} ${STAGEDIR}${PREFIX}/bin/${FILE}
 .endfor
 	${INSTALL_DATA} ${WRKSRC}/examples/smsd.conf.easy ${STAGEDIR}${PREFIX}/etc/smsd.conf.sample
 	${MKDIR} ${STAGEDIR}${DOCSDIR}/slideshow
diff --git a/comms/smstools3/files/pkg-deinstall.in b/comms/smstools3/files/pkg-deinstall.in
deleted file mode 100644
index 726b8856a0e9..000000000000
--- a/comms/smstools3/files/pkg-deinstall.in
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-if [ "x$2" = "xPOST-DEINSTALL" ]; then
-	rmdir %%SPOOLDIR%%/incoming %%SPOOLDIR%%/outgoing \
-	%%SPOOLDIR%%/checked %%SPOOLDIR%% %%LOGDIR%% %%PIDDIR%% \
-	2>/dev/null || true
-	echo
-	echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
-	echo "If you are permanently removing smstools, you should also:" | /usr/bin/fmt
-	echo "'rm -rf %%SPOOLDIR%%'"
-	echo "'rm -rf %%LOGDIR%%'"
-	echo "'rm -rf %%PIDDIR%%'"
-	echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
-fi
diff --git a/comms/smstools3/files/pkg-install.in b/comms/smstools3/files/pkg-install.in
deleted file mode 100644
index 19e362078a62..000000000000
--- a/comms/smstools3/files/pkg-install.in
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-if [ "x$2" = "xPOST-INSTALL" ]; then
-	mkdir -p %%SPOOLDIR%%/incoming %%SPOOLDIR%%/outgoing \
-		%%SPOOLDIR%%/checked %%LOGDIR%% %%PIDDIR%%
-	chown -R %%SMSD_USER%%:%%SMSD_GROUP%% %%SPOOLDIR%% \
-		%%LOGDIR%% %%PIDDIR%%
-fi
diff --git a/comms/smstools3/files/pkg-message.in b/comms/smstools3/files/pkg-message.in
new file mode 100644
index 000000000000..24350daa10e8
--- /dev/null
+++ b/comms/smstools3/files/pkg-message.in
@@ -0,0 +1,11 @@
+[
+{ type: remove
+  message: <<EOM
+If you are permanently removing smstools, you should also:
+
+rm -rf %%SPOOLDIR%%
+rm -rf %%LOGDIR%%
+rm -rf %%PIDDIR%%
+EOM
+}
+]