aboutsummaryrefslogtreecommitdiff
path: root/databases/memcached
diff options
context:
space:
mode:
authorSteve Wills <swills@FreeBSD.org>2011-09-30 13:52:30 +0000
committerSteve Wills <swills@FreeBSD.org>2011-09-30 13:52:30 +0000
commitb22b80b1b4d3961ba51867a4fa0f4f719eca1d89 (patch)
tree38375099e968337f7f6e631deaf826f35f4d284f /databases/memcached
parent9bdf899a9d90b2732e084ef28a5a691aa70450a7 (diff)
downloadports-b22b80b1b4d3961ba51867a4fa0f4f719eca1d89.tar.gz
ports-b22b80b1b4d3961ba51867a4fa0f4f719eca1d89.zip
Notes
Diffstat (limited to 'databases/memcached')
-rw-r--r--databases/memcached/Makefile5
-rw-r--r--databases/memcached/files/memcached.in42
2 files changed, 28 insertions, 19 deletions
diff --git a/databases/memcached/Makefile b/databases/memcached/Makefile
index d81be537cb58..0ac72b4664ef 100644
--- a/databases/memcached/Makefile
+++ b/databases/memcached/Makefile
@@ -7,6 +7,7 @@
PORTNAME= memcached
PORTVERSION= 1.4.7
+PORTREVISION= 1
CATEGORIES= databases
MASTER_SITES= ${MASTER_SITE_GOOGLE_CODE} \
${MASTER_SITE_GENTOO}
@@ -31,7 +32,7 @@ MAN1= memcached.1
PLIST_FILES= bin/memcached \
bin/memcached-tool \
include/memcached/protocol_binary.h
-PLIST_DIRS= include/memcached /var/run/memcached
+PLIST_DIRS= include/memcached
PORTDOCS= protocol.txt readme.txt
@@ -65,8 +66,6 @@ post-configure:
post-install:
${INSTALL_SCRIPT} ${WRKSRC}/scripts/memcached-tool ${PREFIX}/bin
${INSTALL_MAN} ${WRKSRC}/doc/${MAN1} ${MAN1PREFIX}/man/man1
- @${MKDIR} -p /var/run/memcached
- @${CHOWN} nobody:nobody /var/run/memcached
.if !defined(NOPORTDOCS)
@${ECHO_MSG} "===> Installing documentation for ${PKGNAME}"
@${MKDIR} ${DOCSDIR}
diff --git a/databases/memcached/files/memcached.in b/databases/memcached/files/memcached.in
index 6d11b06f54ae..6ab6717d3216 100644
--- a/databases/memcached/files/memcached.in
+++ b/databases/memcached/files/memcached.in
@@ -1,9 +1,9 @@
#!/bin/sh
-#
+
# $FreeBSD$
#
# PROVIDE: memcached
-# REQUIRE: DAEMON
+# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to run memcached:
@@ -16,36 +16,35 @@
# Default is "nobody".
# memcached_profiles (str): Set to "" by default.
# Define your profiles here.
-#
. /etc/rc.subr
name="memcached"
rcvar=${name}_enable
-_pidprefix="/var/run/memcached/memcached"
-pidfile="${_pidprefix}.pid"
+_piddir="/var/run/memcached"
+pidfile="${_piddir}/memcached.pid"
load_rc_config ${name}
if [ -n "$2" ]; then
profile="$2"
if [ "x${memcached_profiles}" != "x" ]; then
- pidfile="${_pidprefix}.${profile}.pid"
+ pidfile="${_piddir}/memcached.${profile}.pid"
eval memcached_enable="\${memcached_${profile}_enable:-${memcached_enable}}"
eval memcached_flags="\${memcached_${profile}_flags:-${memcached_flags}}"
else
echo "$0: extra argument ignored"
fi
else
- if [ "x${memcached_profiles}" != "x" -a "x$1" != "x" ]; then
+ if [ -n "${memcached_profiles}" -a -n "$1" ]; then
for profile in ${memcached_profiles}; do
eval _enable="\${memcached_${profile}_enable}"
- case "x${_enable:-${memcached_enable}}" in
- x[Nn][Oo]|x[Ff][Aa][Ll][Ss][Ee]|x[Oo][Ff][Ff]|x0)
+ case "${_enable:-${memcached_enable}}" in
+ [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
continue
;;
- x[Yy][Ee][Ss]|x[Tt][Rr][Uu][Ee]|x[Oo][Nn]|x1)
+ [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
;;
*)
if test -z "$_enable"; then
@@ -53,7 +52,7 @@ else
else
_var=memcached_"${profile}"_enable
fi
- echo "Bad value" \
+ warn "Bad value" \
"'${_enable:-${memcached_enable}}'" \
"for ${_var}. " \
"Profile ${profile} skipped."
@@ -61,22 +60,33 @@ else
;;
esac
echo "===> memcached profile: ${profile}"
- /usr/local/etc/rc.d/memcached $1 ${profile}
- retcode="$?"
- if [ "0${retcode}" -ne 0 ]; then
- failed="${profile} (${retcode}) ${failed:-}"
- else
+ if $0 $1 ${profile} ; then
success="${profile} ${success:-}"
+ else
+ failed="${profile} (${retcode}) ${failed:-}"
fi
done
exit 0
fi
fi
+memcached_poststop()
+{
+ local file
+
+ for file in ${_piddir}/* ; do
+ case "$file" in *\*) continue ;; esac
+ unlink $file
+ done
+}
+
: ${memcached_enable="NO"}
: ${memcached_user="nobody"}
command=%%PREFIX%%/bin/memcached
command_args="-d -u ${memcached_user} -P ${pidfile} "
+start_precmd="install -d -o $memcached_user -g $memcached_user -m 755 $_piddir"
+stop_postcmd="${name}_poststop"
+
run_rc_command "$1"