diff options
author | swills <swills@FreeBSD.org> | 2011-07-02 06:33:09 +0800 |
---|---|---|
committer | swills <swills@FreeBSD.org> | 2011-07-02 06:33:09 +0800 |
commit | 3c8da3c65272ee46daf3dcaf6311482893a0cd26 (patch) | |
tree | 805899bcb6a11ac457d621539489222b5319a9b2 | |
parent | 6bc8c214394c9ef489dae096efe57424461a34c0 (diff) | |
download | freebsd-ports-gnome-3c8da3c65272ee46daf3dcaf6311482893a0cd26.tar.gz freebsd-ports-gnome-3c8da3c65272ee46daf3dcaf6311482893a0cd26.tar.zst freebsd-ports-gnome-3c8da3c65272ee46daf3dcaf6311482893a0cd26.zip |
- add profiles support to init script
PR: ports/155533
Submitted by: swills
Approved by: maintainer timeout (mnag)
-rw-r--r-- | databases/memcached/Makefile | 6 | ||||
-rw-r--r-- | databases/memcached/files/memcached.in | 52 |
2 files changed, 55 insertions, 3 deletions
diff --git a/databases/memcached/Makefile b/databases/memcached/Makefile index a001770b8f9f..9ef9e814343d 100644 --- a/databases/memcached/Makefile +++ b/databases/memcached/Makefile @@ -7,7 +7,7 @@ PORTNAME= memcached PORTVERSION= 1.4.5 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= databases MASTER_SITES= ${MASTER_SITE_GOOGLE_CODE} \ ${MASTER_SITE_GENTOO} @@ -32,7 +32,7 @@ MAN1= memcached.1 PLIST_FILES= bin/memcached \ bin/memcached-tool \ include/memcached/protocol_binary.h -PLIST_DIRS= include/memcached +PLIST_DIRS= include/memcached /var/run/memcached PORTDOCS= protocol.txt threads.txt readme.txt @@ -67,6 +67,8 @@ 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 73110c6720c6..e427c45ac469 100644 --- a/databases/memcached/files/memcached.in +++ b/databases/memcached/files/memcached.in @@ -13,6 +13,8 @@ # Default is empty "". # memcached_user (user): Set user to run memcached. # Default is "nobody". +# memcached_profiles (str): Set to "" by default. +# Define your profiles here. # . /etc/rc.subr @@ -20,13 +22,61 @@ name="memcached" rcvar=${name}_enable +_pidprefix="/var/run/memcached/memcached" +pidfile="${_pidprefix}.pid" + load_rc_config ${name} +if [ -n "$2" ]; then + profile="$2" + if [ "x${memcached_profiles}" != "x" ]; then + pidfile="${_pidprefix}.${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 + for profile in ${memcached_profiles}; do + eval _enable="\${memcached_${profile}_enable}" + case "x${_enable:-${memcached_enable}}" in + x|x[Nn][Oo]|x[Nn][Oo][Nn][Ee]) + continue + ;; + x[Yy][Ee][Ss]) + ;; + *) + if test -z "$_enable"; then + _var=memcached_enable + else + _var=memcached_"${profile}"_enable + fi + echo "Bad value" \ + "'${_enable:-${memcached_enable}}'" \ + "for ${_var}. " \ + "Profile ${profile} skipped." + continue + ;; + 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 + success="${profile} ${success:-}" + fi + done + exit 0 + fi +fi + : ${memcached_enable="NO"} : ${memcached_user="nobody"} command=%%PREFIX%%/bin/memcached -command_args="-d -u ${memcached_user}" +command_args="-d -u ${memcached_user} -P ${pidfile} " unset memcached_user |