svn commit: r393250 - in head/comms/aprsd: . files
Mark Felder
feld at FreeBSD.org
Thu Jul 30 15:48:55 UTC 2015
Author: feld
Date: Thu Jul 30 15:48:52 2015
New Revision: 393250
URL: https://svnweb.freebsd.org/changeset/ports/393250
Log:
comms/aprsd: Modernize port
USE_RC_SUBR
USERS and GROUPS instead of custom script
Unmute some install steps
LICENSE
The rc script now passes rclint
Approved by: db
Differential Revision: https://reviews.freebsd.org/D3104
Added:
head/comms/aprsd/files/aprsd.in
- copied, changed from r392743, head/comms/aprsd/files/aprsd
head/comms/aprsd/files/pkg-deinstall.in
- copied, changed from r392743, head/comms/aprsd/pkg-deinstall
Deleted:
head/comms/aprsd/files/aprsd
head/comms/aprsd/pkg-deinstall
head/comms/aprsd/pkg-install
Modified:
head/comms/aprsd/Makefile
head/comms/aprsd/pkg-plist
Modified: head/comms/aprsd/Makefile
==============================================================================
--- head/comms/aprsd/Makefile Thu Jul 30 14:37:30 2015 (r393249)
+++ head/comms/aprsd/Makefile Thu Jul 30 15:48:52 2015 (r393250)
@@ -11,36 +11,45 @@ DISTNAME= aprsd-2.2.5-15
MAINTAINER= hamradio at FreeBSD.org
COMMENT= Server daemon providing Internet access to APRS packet data
+LICENSE= GPLv2
+
GNU_CONFIGURE= yes
-SUB_FILES= pkg-message
+SUB_FILES= pkg-message pkg-deinstall
+USE_RC_SUBR= aprsd
+
+USERS= aprsd tnc
+GROUPS= aprsd tnc
+APRSD_RC_USER= aprsd
+APRSD_RC_GROUP= aprsd
+
+RC_SUB_LIST= LOCALBASE=${LOCALBASE} APRSD_RC_USER=${APRSD_RC_USER} \
+ APRSD_RC_GROUP=${APRSD_RC_GROUP}
OPTIONS_DEFINE= DOCS EXAMPLES
.include <bsd.port.pre.mk>
post-patch:
- @${REINPLACE_CMD} -e 's|%%CONFPATH%%|${PREFIX}/etc/aprsd/|' \
+ ${REINPLACE_CMD} -e 's|%%CONFPATH%%|${PREFIX}/etc/aprsd/|' \
-e 's|%%LOGPATH%%|/var/log/aprsd/|' \
${WRKSRC}/src/aprsd.cpp
- @${REINPLACE_CMD} -e 's|%%LOGPATH%%|/var/log/aprsd/|' \
+ ${REINPLACE_CMD} -e 's|%%LOGPATH%%|/var/log/aprsd/|' \
${WRKSRC}/src/utils.cpp
pre-install:
- @${MKDIR} ${STAGEDIR}${PREFIX}/etc/aprsd
- @${MKDIR} ${STAGEDIR}"/var/log/aprsd"
- @${SETENV} "PKG_PREFIX=${STAGEDIR}${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+ ${MKDIR} ${STAGEDIR}${PREFIX}/etc/aprsd
+ ${MKDIR} ${STAGEDIR}"/var/log/aprsd"
post-install:
@cd ${WRKSRC}/admin
.for f in INIT.TNC RESTORE.TNC aprsd.conf welcome.txt user.deny
- @${INSTALL_DATA} ${WRKSRC}/admin/$f ${STAGEDIR}${PREFIX}/etc/aprsd/$f.samp
+ ${INSTALL_DATA} ${WRKSRC}/admin/$f ${STAGEDIR}${PREFIX}/etc/aprsd/$f.samp
.endfor
- @${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+ ${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
.for f in chkaprsd udp_example
- @${INSTALL_DATA} ${WRKSRC}/admin/$f ${STAGEDIR}${EXAMPLESDIR}
+ ${INSTALL_DATA} ${WRKSRC}/admin/$f ${STAGEDIR}${EXAMPLESDIR}
.endfor
- @${INSTALL_SCRIPT} ${FILESDIR}/aprsd ${STAGEDIR}${LOCALBASE}/etc/rc.d
- @${MKDIR} ${STAGEDIR}${DOCSDIR}
- @${CP} ${WRKSRC}/doc/*.html ${STAGEDIR}${DOCSDIR}
+ ${MKDIR} ${STAGEDIR}${DOCSDIR}
+ ${CP} ${WRKSRC}/doc/*.html ${STAGEDIR}${DOCSDIR}
.include <bsd.port.post.mk>
Copied and modified: head/comms/aprsd/files/aprsd.in (from r392743, head/comms/aprsd/files/aprsd)
==============================================================================
--- head/comms/aprsd/files/aprsd Thu Jul 23 17:56:27 2015 (r392743, copy source)
+++ head/comms/aprsd/files/aprsd.in Thu Jul 30 15:48:52 2015 (r393250)
@@ -1,7 +1,10 @@
#!/bin/sh
#
+# $FreeBSD$
+#
# PROVIDE: aprsd
# REQUIRE: NETWORKING
+# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf
# aprsd_enable="YES"
@@ -9,62 +12,32 @@
. /etc/rc.subr
-name="aprsd"
+name=aprsd
rcvar=aprsd_enable
load_rc_config $name
-aprsd_enable=${aprsd_enable-"NO"}
-aprsd_root=${aprsd_root-"NO"}
-command="/usr/local/bin/aprsd"
-start_cmd=aprsd_start
-stop_cmd=aprsd_stop
+: ${aprsd_enable=NO}
+: ${aprsd_root=NO}
+: ${aprsd_user=%%APRSD_RC_USER%%}
+: ${aprsd_group=%%APRSD_RC_GROUP%%}
-PIDFILE="/var/run/aprsd.pid"
-UID="aprsd"
-GID="aprsd"
-#
-# aprsd.init for version 2.1.5. starts or stops aprsd server.
-# This file should be placed in /usr/local/etc/rc.d/
-#
-#
-#
-# Author: Dale Heatherington <aprsd1 at wa4dsy.net>
-# Modified: Diane Bruce <va3db at amsat.org>
+command=%%LOCALBASE%%/bin/aprsd
+start_precmd=aprsd_pre
+stop_cmd=aprsd_stop
+pidfile=/var/run/aprsd.pid
-# Source function library.
-#. /etc/rc.d/init.d/functions
-# See how we were called.
-aprsd_start()
+aprsd_pre()
{
- if [ -s ${PIDFILE} ] ; then
- kill -0 `cat ${PIDFILE}` >&- 2>&-
- if [ $? -eq 0 ]; then
- echo "aprs server is already running."
- return 0
- fi
- fi
if [ ${aprsd_root} != "YES" ]; then
- echo "Starting aprs server as user ${UID}:${GID}."
- touch ${PIDFILE}
- chown ${UID}:${GID} ${PIDFILE}
- chown ${UID}:${GID} /var/log/aprsd
- chown ${UID}:${GID} /var/log/aprsd/*
- su ${UID} -m -c "${command} -d"
+ echo "Starting aprs server as user ${APRSD_RC_USER}:${APRSD_RC_GROUP}."
+ install -o ${APRSD_RC_USER} -g ${APRSD_RC_GROUP} /dev/null ${pidfile}
+ chown -R ${APRSD_RC_USER}:${APRSD_RC_GROUP} /var/log/aprsd
else
echo "Starting aprs server as root."
- chown root:wheel ${PIDFILE}
- chown root:wheel /var/log/aprsd
- chown root:wheel /var/log/aprsd/*
-
- ${command} -d
+ install -o root -g wheel /dev/null ${pidfile}
+ chown -R root:wheel /var/log/aprsd
fi
return 0
}
-aprsd_stop()
-{
- echo "Stopping aprs server daemon. "
- kill -INT `cat ${PIDFILE}`
- return 0
-}
run_rc_command "$1"
Copied and modified: head/comms/aprsd/files/pkg-deinstall.in (from r392743, head/comms/aprsd/pkg-deinstall)
==============================================================================
--- head/comms/aprsd/pkg-deinstall Thu Jul 23 17:56:27 2015 (r392743, copy source)
+++ head/comms/aprsd/files/pkg-deinstall.in Thu Jul 30 15:48:52 2015 (r393250)
@@ -1,16 +1,8 @@
#!/bin/sh
-if [ "x$2" != "xPOST-DEINSTALL" ]; then
- exit 0;
-fi
-
-echo "Killing aprsd if running"
-kill -9 `cat /var/run/aprsd.pid`
-rm -f /var/run/aprsd.pid
-
cat<<EOF
If you really want to remove this package completely
-remove what is left in /usr/local/etc/aprsd /var/log/aprsd.
+remove what is left in %%LOCALBASE%%/etc/aprsd /var/log/aprsd.
Also be sure to remove user and groups aprsd and tnc
and remember to remove aprsd from dialer group.
EOF
Modified: head/comms/aprsd/pkg-plist
==============================================================================
--- head/comms/aprsd/pkg-plist Thu Jul 30 14:37:30 2015 (r393249)
+++ head/comms/aprsd/pkg-plist Thu Jul 30 15:48:52 2015 (r393250)
@@ -5,7 +5,6 @@ etc/aprsd/RESTORE.TNC.samp
etc/aprsd/aprsd.conf.samp
etc/aprsd/user.deny.samp
etc/aprsd/welcome.txt.samp
-etc/rc.d/aprsd
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/chkaprsd
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/udp_example
%%PORTDOCS%%%%DOCSDIR%%/aprsddoc.html
More information about the svn-ports-all
mailing list