Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167632949
D8504.id22164.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D8504.id22164.diff
View Options
Index: Keywords/service.ucl
===================================================================
--- /dev/null
+++ Keywords/service.ucl
@@ -0,0 +1,39 @@
+# $FreeBSD: head/Keywords/shell.ucl 417133 2016-06-19 22:21:22Z bapt $
+#
+# MAINTAINER: bapt@FreeBSD.org
+#
+# @service service port protocol service entry
+#
+# Handle adding and remove entries in /etc/services
+#
+
+actions: []
+post-install: <<EOD
+ args="%@"
+ set -- $args
+ name=$1
+ port=$2
+ protocol=$3
+ shift 3
+ comment=$@
+ awk -v name=$name -v port="$port/$protocol" \
+ '$1 == name && $2 == port { found++ } END { exit found }' \
+ ${PKG_ROOTDIR}/etc/services
+ if [ $? -eq 0 ]; then
+ echo "===> add entry in etc/services: '$name $port/$protocol'"
+ echo "$name $port/$protocol # $comment" >> ${PKG_ROOTDIR}/etc/services
+ fi
+EOD
+pre-deinstall: <<EOD
+ args="%@"
+ set -- $args
+ awk -v name=$1 -v port="$2/$3" \
+ '$1 == name && $2 == port { found++ } END { exit found }' \
+ ${PKG_ROOTDIR}/etc/services
+ if [ $? -ne 0 ]; then
+ echo "===> Removing entry in etc/services: '$1 $2/$3'"
+ sed -i '' \
+ -Ee "/^$1[[:space:]]+$2\/$3[[:space:]].*/d" \
+ ${PKG_ROOTDIR}/etc/services
+ fi
+EOD
Index: mail/spamd/Makefile
===================================================================
--- mail/spamd/Makefile
+++ mail/spamd/Makefile
@@ -3,7 +3,7 @@
PORTNAME= spamd
PORTVERSION= 4.9.1
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= mail
MASTER_SITES= SF/freebsdspamd/spamd
@@ -28,7 +28,10 @@
man/man8/spamd-setup.8.gz \
man/man8/spamd.8.gz \
man/man8/spamdb.8.gz \
- man/man8/spamlogd.8.gz
+ man/man8/spamlogd.8.gz \
+ "@service spamd 8025 tcp spamd(8)" \
+ "@service spamd-sync 8025 udp spamd(8) synchronisation" \
+ "@service spamd-cfg 8026 tcp spamd(8) configuration"
SUB_LIST= SPAMDUSER=${USERS} \
SPAMDGROUP=${GROUPS}
Index: mail/spamd/files/pkg-install.in
===================================================================
--- mail/spamd/files/pkg-install.in
+++ mail/spamd/files/pkg-install.in
@@ -7,7 +7,6 @@
SPAMDUSER=%%SPAMDUSER%%
SPAMDGROUP=%%SPAMDGROUP%%
-FILE="/etc/services"
check_db() {
DB=/var/db/spamd
@@ -25,48 +24,6 @@
fi
}
-check_service() {
- local SERVICE PORT PROTO COMMENT
-
- SERVICE=$1
- PORT=$2
- PROTO=$3
- COMMENT=$4
-
- # check
- OK=no
- HAS_SERVICE=no
- COUNT=1
- for i in $(grep ^${SERVICE} ${FILE}); do
- if [ ${COUNT} -eq 1 ] && [ x"${i}" = x"${SERVICE}" ]; then
- HAS_SERVICE=yes
- elif [ ${COUNT} -eq 2 ] && [ "${HAS_SERVICE}" = "yes" ] && \
- [ x"${i}" = x"${PORT}/${PROTO}" ]; then
- OK=yes
- break
- fi
- COUNT=$(( ${COUNT} + 1 ))
- done
- # add an entry for SERVICE to /etc/services
- if [ "${OK}" = "no" ]; then
- echo "==> add entry \"${SERVICE} ${PORT}/${PROTO}\""
- (
- grep -v -e "^${SERVICE}.*${PORT}/${PROTO}" ${FILE}
- echo "${SERVICE} ${PORT}/${PROTO} # ${COMMENT}"
- ) >> ${FILE}.new
- mv ${FILE}.new ${FILE}
- fi
-}
-
-# always add service entries
-if [ "$2" = "PRE-INSTALL" ]; then
- echo "Checking ${FILE} for missing service entries"
- [ ! -f ${FILE} ] && echo "==> cannot find ${FILE} ... => exit" && exit 1
- check_service spamd 8025 tcp "spamd(8)"
- check_service spamd-sync 8025 udp "spamd(8) synchronisation"
- check_service spamd-cfg 8026 tcp "spamd(8) configuration"
-fi
-
if [ "$2" = "POST-INSTALL" ]; then
check_db
fi
Index: mail/spamd/pkg-deinstall
===================================================================
--- mail/spamd/pkg-deinstall
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-#
-# ex:ts=4:sw=4:noet
-#-*- mode: makefile; tab-width: 4; -*-
-#
-# $FreeBSD$
-
-if [ "$2" = "DEINSTALL" ]; then
- FILE="/etc/services"
- echo "===> Removing spamd entries from ${FILE}"
- sed -i '' \
- -e "/^spamd-sync.*8025/d" \
- -e "/^spamd-cfg.*8026/d" \
- -e "/^spamd.*8025/d" \
- ${FILE}
-fi
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Aug 24, 8:45 AM (12 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37178957
Default Alt Text
D8504.id22164.diff (3 KB)
Attached To
Mode
D8504: Add a keyword to handle services
Attached
Detach File
Event Timeline
Log In to Comment