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]
This commit is contained in:
Guido Falsi 2022-07-27 22:29:54 +02:00
parent ca17004b6d
commit 3109e75af7
4 changed files with 29 additions and 36 deletions

View file

@ -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
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
CONFLICTS_INSTALL= gnokii sendsms # bin/sendsms
WRKSRC= ${WRKDIR}/smstools3
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

View file

@ -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

View file

@ -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

View file

@ -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
}
]