Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147731275
D3104.id7513.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
10 KB
Referenced Files
None
Subscribers
None
D3104.id7513.diff
View Options
Index: head/comms/aprsd/Makefile
===================================================================
--- head/comms/aprsd/Makefile
+++ head/comms/aprsd/Makefile
@@ -11,36 +11,45 @@
MAINTAINER= hamradio@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>
Index: head/comms/aprsd/files/aprsd
===================================================================
--- head/comms/aprsd/files/aprsd
+++ head/comms/aprsd/files/aprsd
@@ -1,70 +0,0 @@
-#!/bin/sh
-#
-# PROVIDE: aprsd
-# REQUIRE: NETWORKING
-#
-# Add the following lines to /etc/rc.conf
-# aprsd_enable="YES"
-# aprsd_root="YES" or aprsd_root="NO"
-
-. /etc/rc.subr
-
-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
-
-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@wa4dsy.net>
-# Modified: Diane Bruce <va3db@amsat.org>
-
-# Source function library.
-#. /etc/rc.d/init.d/functions
-# See how we were called.
-aprsd_start()
-{
- 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"
- 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
- fi
- return 0
-}
-aprsd_stop()
-{
- echo "Stopping aprs server daemon. "
- kill -INT `cat ${PIDFILE}`
- return 0
-}
-
-run_rc_command "$1"
Index: head/comms/aprsd/files/aprsd.in
===================================================================
--- head/comms/aprsd/files/aprsd.in
+++ head/comms/aprsd/files/aprsd.in
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: aprsd
+# REQUIRE: NETWORKING
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf
+# aprsd_enable="YES"
+# aprsd_root="YES" or aprsd_root="NO"
+
+. /etc/rc.subr
+
+name=aprsd
+rcvar=aprsd_enable
+load_rc_config $name
+
+: ${aprsd_enable=NO}
+: ${aprsd_root=NO}
+: ${aprsd_user=%%APRSD_RC_USER%%}
+: ${aprsd_group=%%APRSD_RC_GROUP%%}
+
+command=%%LOCALBASE%%/bin/aprsd
+start_precmd=aprsd_pre
+stop_cmd=aprsd_stop
+pidfile=/var/run/aprsd.pid
+
+aprsd_pre()
+{
+ if [ ${aprsd_root} != "YES" ]; then
+ 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."
+ install -o root -g wheel /dev/null ${pidfile}
+ chown -R root:wheel /var/log/aprsd
+ fi
+ return 0
+}
+
+run_rc_command "$1"
Index: head/comms/aprsd/files/pkg-deinstall.in
===================================================================
--- head/comms/aprsd/files/pkg-deinstall.in
+++ head/comms/aprsd/files/pkg-deinstall.in
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+cat<<EOF
+If you really want to remove this package completely
+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
Index: head/comms/aprsd/pkg-deinstall
===================================================================
--- head/comms/aprsd/pkg-deinstall
+++ head/comms/aprsd/pkg-deinstall
@@ -1,16 +0,0 @@
-#!/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.
-Also be sure to remove user and groups aprsd and tnc
-and remember to remove aprsd from dialer group.
-EOF
Index: head/comms/aprsd/pkg-install
===================================================================
--- head/comms/aprsd/pkg-install
+++ head/comms/aprsd/pkg-install
@@ -1,142 +0,0 @@
-#!/bin/sh
-
-UID=240
-GID=${UID}
-DAEMON_NAME="aprsd"
-UID_NAME=${DAEMON_NAME}
-GID_NAME=${DAEMON_NAME}
-
-TNC_UID=241
-TNC_GID=${TNC_UID}
-TNC_UID_NAME="tnc"
-TNC_GID_NAME="tnc"
-
-if [ "x$2" != "xPRE-INSTALL" ]; then
- exit 0;
-fi
-
-ask() {
- local question default answer
-
- question=$1
- default=$2
- if [ -z "${PACKAGE_BUILDING}" ]; then
- read -p "${question} [${default}]? " answer
- fi
- if [ x${answer} = x ]; then
- answer=${default}
- fi
- echo ${answer}
-}
-
-yesno() {
- local dflt question answer
-
- question=$1
- dflt=$2
- while :; do
- answer=$(ask "${question}" "${dflt}")
- case "${answer}" in
- [Yy]*) return 0;;
- [Nn]*) return 1;;
- esac
- echo "Please answer yes or no."
- done
-}
-
-adduser() {
- local uid gid uid_name gid_name daemon_name
-
- uid=$1
- gid=$2
- uid_name=$3
- gid_name=$4
- daemon_name=$5
- if which -s pw ; then
- :
- else
- cat <<EOF
-Your system does not include the "pw" utility. You should upgrade
-to a newer version of FreeBSD. Without "pw" this script will not
-run.
-EOF
- exit 1
- fi
-
- echo ""
- if pw groupshow ${gid_name} 2> /dev/null ; then
- echo "You already have a group \"${gid_name}\", so I will use it."
- else
- if pw groupshow ${gid} 2> /dev/null ; then
- echo "You already have a gid \"${gid}\". Please create a user ${gid_name}"
- echo "with a default group of \"${gid_name}\"."
- exit 1
- fi
- echo "You need a group \"${gid_name}\"."
- if which -s pw && yesno "Would you like me to create it" y; then
- pw groupadd ${gid_name} -g ${gid} || exit
- echo "Done."
- else
- echo "Please create it, and try again."
- if ! pw usershow ${uid_name} 2> /dev/null ; then
- echo "While you're at it, please create a user \"${uid_name}\""
- echo 'too, with a default group of "${gid_name}".'
- fi
- exit 1
- fi
- fi
-
- if pw usershow ${uid_name} 2> /dev/null ; then
- echo "You already have a user \"${uid_name}\", so I will use it."
- else
- if pw usershow ${uid} 2> /dev/null ; then
- echo "You already have a uid \"${uid}\". Please create a user \"${uid_name}\""
- echo "with a default group of \"${gid_name}\"."
- exit 1
- fi
- echo "You need a user \"${uid_name}\"."
- if which -s pw && yesno "Would you like me to create it" y; then
- pw useradd ${uid_name} -g ${gid_name} -u ${uid} -h - -d /nonexistent \
- -s /bin/sh -c "${daemon_name}" || exit
- echo "Done."
- else
- echo "Please create it, and try again."
- exit 1
- fi
- fi
-}
-
-(adduser ${UID} ${GID} ${UID_NAME} ${GID_NAME} ${DAEMON_NAME})
-
-echo `pw groupshow dialer`|grep -q ${UID_NAME}
-if [ $? -eq 0 ]; then
- echo "You already have \"${UID_NAME}\" in the dialer group, so I will use this."
-else
-cat<<EOF
-${DAEMON_NAME} needs access to serial ports to talk to an
-external tnc. You will be asked if you wish to add ${DAEMON_NAME}
-to the dialer group for that purpose.
-EOF
- if pw usershow ${UID_NAME} 2> /dev/null ; then
- if which -s pw && yesno "Would you like to add \"${UID_NAME}\" to the dialer group?" y; then
- pw groupmod -n "dialer" -m ${UID_NAME} || exit
- echo "Done."
- fi
- fi
-fi
-
-if ! pw usershow ${TNC_UID_NAME} 2> /dev/null ; then
-cat<<EOF
-"${DAEMON_NAME}" has an optional login "${TNC_UID_NAME}",
-(This is described in the aprsd docs.) if you
-wish to allow remote logins. "${DAEMON_NAME}" needs to run as
-root for this to work, if you do not plan to run
-"${DAEMON_NAME}" ever as root, you can skip this step.
-You can always add it manually later if you change your mind.
-EOF
- if which -s pw && yesno "Would you like to add a ${TNC_UID_NAME} login" y; then
- (adduser ${TNC_UID} ${TNC_GID} ${TNC_UID_NAME} ${TNC_GID_NAME} ${DAEMON_NAME})
- fi
-else
- echo "You already have an user \"${TNC_UID_NAME}\" so I will use it."
-fi
Index: head/comms/aprsd/pkg-plist
===================================================================
--- head/comms/aprsd/pkg-plist
+++ head/comms/aprsd/pkg-plist
@@ -5,7 +5,6 @@
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
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 14, 6:33 AM (9 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29657391
Default Alt Text
D3104.id7513.diff (10 KB)
Attached To
Mode
D3104: comms/aprsd: cleanup & modernization
Attached
Detach File
Event Timeline
Log In to Comment