Index: Makefile =================================================================== RCS file: /home/pcvs/ports/databases/memcached/Makefile,v retrieving revision 1.52 diff -u -r1.52 Makefile --- Makefile 23 Sep 2011 22:21:35 -0000 1.52 +++ Makefile 28 Sep 2011 21:09:46 -0000 @@ -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 @@ 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-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} Index: files/memcached.in =================================================================== RCS file: /home/pcvs/ports/databases/memcached/files/memcached.in,v retrieving revision 1.6 diff -u -r1.6 memcached.in --- files/memcached.in 14 Aug 2011 00:44:33 -0000 1.6 +++ files/memcached.in 28 Sep 2011 21:09:46 -0000 @@ -1,9 +1,9 @@ #!/bin/sh -# + # $FreeBSD: ports/databases/memcached/files/memcached.in,v 1.6 2011/08/14 00:44:33 swills Exp $ # # 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 _var=memcached_"${profile}"_enable fi - echo "Bad value" \ + warn "Bad value" \ "'${_enable:-${memcached_enable}}'" \ "for ${_var}. " \ "Profile ${profile} skipped." @@ -61,22 +60,33 @@ ;; 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"