aboutsummaryrefslogtreecommitdiffstats
path: root/comms/smstools3
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2008-11-21 20:03:56 +0800
committermm <mm@FreeBSD.org>2008-11-21 20:03:56 +0800
commit57b77a58666c8f5037f7d5a3a8212d2974a45e0d (patch)
tree15c2ab9a5ddb79dd8ceb6c00c835036f26670b76 /comms/smstools3
parentd993b6e93ccb842e324a411c5060635c6ab86d1b (diff)
downloadfreebsd-ports-gnome-57b77a58666c8f5037f7d5a3a8212d2974a45e0d.tar.gz
freebsd-ports-gnome-57b77a58666c8f5037f7d5a3a8212d2974a45e0d.tar.zst
freebsd-ports-gnome-57b77a58666c8f5037f7d5a3a8212d2974a45e0d.zip
- New RCNG script for smstools3
- Improved security (runas uucp:dialer) - Some ideas imported from [1] PR: ports/128681 [1] Submitted by: Sean McAfee <smcafee at collaborativefusion.com> [1]
Diffstat (limited to 'comms/smstools3')
-rw-r--r--comms/smstools3/Makefile29
-rw-r--r--comms/smstools3/files/patch-src-Makefile20
-rw-r--r--comms/smstools3/files/smsd.in31
-rw-r--r--comms/smstools3/pkg-plist5
4 files changed, 61 insertions, 24 deletions
diff --git a/comms/smstools3/Makefile b/comms/smstools3/Makefile
index 4ae0f07e3f60..466657082c84 100644
--- a/comms/smstools3/Makefile
+++ b/comms/smstools3/Makefile
@@ -7,6 +7,7 @@
PORTNAME= smstools
PORTVERSION= 3.1.3
+PORTREVISION= 1
CATEGORIES= comms
MASTER_SITES= http://smstools3.kekekasvi.com/packages/
DISTNAME= smstools3-${PORTVERSION}
@@ -14,16 +15,21 @@ DISTNAME= smstools3-${PORTVERSION}
MAINTAINER= mm@FreeBSD.org
COMMENT= SMS Gateway software for GSM modems and mobile phones
-LIB_DEPENDS= mm:${PORTSDIR}/devel/mm
-
CONFLICTS= gnokii-[0-9]* smstools-2.* sendsms-[0-9]*
+OPTIONS= STATS "Build status and statistics support" on
WRKSRC= ${WRKDIR}/smstools3
USE_GMAKE= yes
USE_RC_SUBR= smsd
SPOOLDIR?= /var/spool/sms
-PLIST_SUB+= PREFIX="${PREFIX}" \
- SPOOLDIR="${SPOOLDIR}"
+LOGDIR?= /var/log/smsd
+PIDDIR?= /var/run/smsd
+SMSD_USER?= uucp
+SMSD_GROUP?= dialer
+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}"
DOCS= alarmhandler.html blacklist.html book.html compiling.html \
configure.html configure2.html costs.html eventhandler.html \
@@ -50,6 +56,15 @@ SCRIPTS= checkhandler-utf-8 email2sms eventhandler-utf-8 forwardsms \
sms2unicode sms2xml sms3 smsevent smsresend smstest.php \
sql_demo unicode2sms
+.include <bsd.port.pre.mk>
+
+.if !defined(WITHOUT_STATS)
+LIB_DEPENDS+= mm.14:${PORTSDIR}/devel/mm
+CFLAGS+= -I${LOCALBASE}/include
+.else
+CFLAGS+= -D NOSTATS
+.endif
+
post-patch:
@${REINPLACE_CMD} 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/install.sh \
${WRKSRC}/src/smsd_cfg.c
@@ -62,12 +77,14 @@ post-install:
@${MKDIR} ${DATADIR}
@${INSTALL_SCRIPT} ${SCRIPTS:S,^,${WRKSRC}/scripts/,} ${DATADIR}
.for FILE in sendsms sms2html sms2unicode unicode2sms
- @${LN} -s ${DATADIR}/${FILE} ${PREFIX}/bin/${FILE}
+ @${LN} -sf ${DATADIR}/${FILE} ${PREFIX}/bin/${FILE}
.endfor
@${INSTALL_DATA} ${WRKSRC}/examples/smsd.conf.easy ${PREFIX}/etc/smsd.conf.sample
@if [ ! -f ${PREFIX}/etc/smsd.conf ]; then \
${CP} ${PREFIX}/etc/smsd.conf.sample ${PREFIX}/etc/smsd.conf; \
fi
+ @${MKDIR} ${SPOOLDIR} ${LOGDIR} ${PIDDIR}
+ @${CHOWN} -R ${SMSD_USER}:${SMSD_GROUP} ${SPOOLDIR} ${LOGDIR} ${PIDDIR}
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}/slideshow
@${INSTALL_DATA} ${DOCS:S,^,${WRKSRC}/doc/,} ${DOCSDIR}/
@@ -78,4 +95,4 @@ post-install:
@${MKDIR} ${EXAMPLESDIR}
@${INSTALL_DATA} ${EXAMPLES:S,^,${WRKSRC}/examples/,} ${EXAMPLESDIR}/
.endif
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/comms/smstools3/files/patch-src-Makefile b/comms/smstools3/files/patch-src-Makefile
new file mode 100644
index 000000000000..6f6d7ab1fd2f
--- /dev/null
+++ b/comms/smstools3/files/patch-src-Makefile
@@ -0,0 +1,20 @@
+--- src/Makefile.orig 2008-11-21 11:41:21.000000000 +0100
++++ src/Makefile 2008-11-21 11:42:39.000000000 +0100
+@@ -6,7 +6,7 @@
+ # CC=gcc
+
+ # Comment this out, to enable statistics
+-CFLAGS += -D NOSTATS
++#CFLAGS += -D NOSTATS
+
+ # Uncomment this to force smsd to run in terminal mode
+ #CFLAGS += -D TERMINAL
+@@ -24,7 +24,7 @@
+ ifneq (,$(findstring NOSTATS,$(CFLAGS)))
+ $(CC) $(CFLAGS) -o $@ $^
+ else
+- $(CC) `mm-config --cflags` $(CFLAGS) -o $@ $^ `mm-config --ldflags --libs`
++ $(CC) `$(LOCALBASE)/bin/mm-config --cflags` $(CFLAGS) -o $@ $^ `$(LOCALBASE)/bin/mm-config --ldflags --libs`
+ @echo "(Please ignore warning about tempnam -- it is used in a safe way)"
+ endif
+
diff --git a/comms/smstools3/files/smsd.in b/comms/smstools3/files/smsd.in
index 2dec3b9ad417..b1d7d1fcda02 100644
--- a/comms/smstools3/files/smsd.in
+++ b/comms/smstools3/files/smsd.in
@@ -10,25 +10,22 @@
#
# smsd_enable="YES"
#
-smsd_enable=${smsd_enable-"NO"}
-
-. %%RC_SUBR%%
+. "%%RC_SUBR%%"
name="smsd"
+
+load_rc_config ${name}
+: ${smsd_enable="NO"}
+: ${smsd_pidfile="%%PIDDIR%%/smsd.pid"}
+: ${smsd_infofile="%%PIDDIR%%/smsd.working"}
+: ${smsd_logfile="%%LOGDIR%%/smsd.log"}
+: ${smsd_config="%%PREFIX%%/etc/smsd.conf"}
+: ${smsd_user="uucp"}
+: ${smsd_group="dialer"}
+
rcvar=`set_rcvar`
-load_rc_config $name
-pidfile="/var/run/smsd.pid"
+pidfile=${smsd_pidfile}
command="%%PREFIX%%/bin/smsd"
-command_args='&'
-
-# Unfortunally we need to this because as the program won't
-# exit cleanly and the terminal will be stuck forever in waitpid.
-case "$1" in
- stop)
- pkill smsd
- ;;
- *)
- run_rc_command "$1"
- ;;
-esac
+command_args="-c${smsd_config} -p${smsd_pidfile} -i${smsd_infofile} -l${smsd_logfile} -u${smsd_user} -g${smsd_group}"
+run_rc_command "$1"
diff --git a/comms/smstools3/pkg-plist b/comms/smstools3/pkg-plist
index a262edf2f671..3d625b57211f 100644
--- a/comms/smstools3/pkg-plist
+++ b/comms/smstools3/pkg-plist
@@ -91,8 +91,11 @@ etc/smsd.conf.sample
%%PORTDOCS%%@dirrm %%DATADIR%%
%%PORTDOCS%%@dirrm %%DOCSDIR%%/slideshow
%%PORTDOCS%%@dirrm %%DOCSDIR%%
-@exec mkdir -p %%SPOOLDIR%%/incoming %%SPOOLDIR%%/outgoing %%SPOOLDIR%%/checked
+@exec mkdir -p %%SPOOLDIR%%/incoming %%SPOOLDIR%%/outgoing %%SPOOLDIR%%/checked %%LOGDIR%% %%PIDDIR%%
+@exec chown -R %%SMSD_USER%%:%%SMSD_GROUP%% %%SPOOLDIR%% %%LOGDIR%% %%PIDDIR%%
@unexec echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
@unexec echo "If you are permanently removing smstools, you should also:" | /usr/bin/fmt
@unexec echo "'rm -rf %%SPOOLDIR%%'" | /usr/bin/fmt
+@unexec echo "'rm -rf %%LOGDIR%%'" | /usr/bin/fmt
+@unexec echo "'rm -rf %%PIDDIR%%'" | /usr/bin/fmt
@unexec echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="