aboutsummaryrefslogtreecommitdiff
path: root/databases/redis-devel
diff options
context:
space:
mode:
Diffstat (limited to 'databases/redis-devel')
-rw-r--r--databases/redis-devel/Makefile59
-rw-r--r--databases/redis-devel/distinfo3
-rw-r--r--databases/redis-devel/files/patch-redis.conf34
-rw-r--r--databases/redis-devel/files/pkg-install.in85
-rw-r--r--databases/redis-devel/files/pkg-message.in8
-rw-r--r--databases/redis-devel/files/redis.sh.in35
-rw-r--r--databases/redis-devel/pkg-descr14
-rw-r--r--databases/redis-devel/pkg-plist6
8 files changed, 244 insertions, 0 deletions
diff --git a/databases/redis-devel/Makefile b/databases/redis-devel/Makefile
new file mode 100644
index 000000000000..ddbf6ec23bb3
--- /dev/null
+++ b/databases/redis-devel/Makefile
@@ -0,0 +1,59 @@
+# New ports collection makefile for: redis
+# Date created: 03 Jul 2009
+# Whom: Sergey Skvortsov <skv@protey.ru>
+#
+# $FreeBSD$
+#
+
+PORTNAME= redis
+PORTVERSION= 0.900
+DISTVERSIONSUFFIX= _2
+CATEGORIES= databases
+MASTER_SITES= GOOGLE_CODE
+
+MAINTAINER= skv@FreeBSD.org
+COMMENT= A persistent key-value database with built-in net interface
+
+LIB_DEPENDS= execinfo.1:${PORTSDIR}/devel/libexecinfo
+
+WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
+
+CFLAGS+= -I${LOCALBASE}/include
+
+USE_RC_SUBR= redis.sh
+BIN_FILES= redis-server redis-benchmark redis-cli
+
+PKGINSTALL= ${WRKDIR}/pkg-install
+PKGDEINSTALL= ${WRKDIR}/pkg-install
+PKGMESSAGE= ${WRKDIR}/pkg-message
+
+REDIS_USER?= redis
+REDIS_UID?= 535
+REDIS_GROUP?= redis
+REDIS_GID?= 535
+
+REDIS_DBDIR?= /var/db/redis
+REDIS_RUNDIR?= /var/run/redis
+REDIS_LOGDIR?= /var/log/redis
+
+SUB_FILES= pkg-message pkg-install
+SUB_LIST+= PORTNAME="${PORTNAME}" \
+ REDIS_USER="${REDIS_USER}" \
+ REDIS_UID="${REDIS_UID}" \
+ REDIS_GROUP="${REDIS_GROUP}" \
+ REDIS_GID="${REDIS_GID}" \
+ REDIS_LOGDIR="${REDIS_LOGDIR}" \
+ REDIS_DBDIR="${REDIS_DBDIR}" \
+ REDIS_RUNDIR="${REDIS_RUNDIR}"
+
+post-build:
+ ${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+ ${WRKSRC}/redis.conf > ${WRKDIR}/redis.conf
+
+do-install:
+ @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+ ${INSTALL_PROGRAM} ${BIN_FILES:C!^!${WRKSRC}/!} ${PREFIX}/bin/
+ ${INSTALL_DATA} ${WRKDIR}/redis.conf ${PREFIX}/etc/redis.conf.sample
+ @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+
+.include <bsd.port.mk>
diff --git a/databases/redis-devel/distinfo b/databases/redis-devel/distinfo
new file mode 100644
index 000000000000..8eff5f5c2176
--- /dev/null
+++ b/databases/redis-devel/distinfo
@@ -0,0 +1,3 @@
+MD5 (redis-0.900_2.tar.gz) = 15ecbb37ba74b455ddfd5995730506bc
+SHA256 (redis-0.900_2.tar.gz) = a2e5baaae0943b0d1cc2f09b8afbf40f5a6f361b968938f277ed0883dfcbadda
+SIZE (redis-0.900_2.tar.gz) = 191386
diff --git a/databases/redis-devel/files/patch-redis.conf b/databases/redis-devel/files/patch-redis.conf
new file mode 100644
index 000000000000..f68bd795ad4a
--- /dev/null
+++ b/databases/redis-devel/files/patch-redis.conf
@@ -0,0 +1,34 @@
+--- redis.conf
++++ redis.conf
+@@ -2,11 +2,11 @@
+
+ # By default Redis does not run as a daemon. Use 'yes' if you need it.
+ # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
+-daemonize no
++daemonize yes
+
+ # When run as a daemon, Redis write a pid file in /var/run/redis.pid by default.
+ # You can specify a custom pid file location here.
+-pidfile /var/run/redis.pid
++pidfile %%REDIS_RUNDIR%%/redis.pid
+
+ # Accept connections on the specified port, default is 6379
+ port 6379
+@@ -39,7 +39,7 @@
+
+ # For default save/load DB in/from the working directory
+ # Note that you must specify a directory not a file name.
+-dir ./
++dir %%REDIS_DBDIR%%/
+
+ # Set server verbosity to 'debug'
+ # it can be one of:
+@@ -51,7 +51,7 @@
+ # Specify the log file name. Also 'stdout' can be used to force
+ # the demon to log on the standard output. Note that if you use standard
+ # output for logging but daemonize, logs will be sent to /dev/null
+-logfile stdout
++logfile %%REDIS_LOGDIR%%/redis.log
+
+ # Set the number of databases. The default database is DB 0, you can select
+ # a different one on a per-connection basis using SELECT <dbid> where
diff --git a/databases/redis-devel/files/pkg-install.in b/databases/redis-devel/files/pkg-install.in
new file mode 100644
index 000000000000..9eec80ea70f9
--- /dev/null
+++ b/databases/redis-devel/files/pkg-install.in
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+# $FreeBSD$
+
+PATH=/bin:/usr/bin:/usr/sbin
+
+USER="%%REDIS_USER%%"
+USER_ID="%%REDIS_UID%%"
+GROUP="%%REDIS_GROUP%%"
+GROUP_ID="%%REDIS_GID%%"
+
+RUNTIME_DIRS="%%REDIS_LOGDIR%% %%REDIS_DBDIR%% %%REDIS_RUNDIR%%"
+
+case $2 in
+PRE-INSTALL)
+
+if [ `id -u` -ne 0 ]; then
+ echo; echo "You must be root to run this step!"; echo; echo
+ exit 1
+fi
+
+RES=`pw groupshow -n ${GROUP} 2>/dev/null`
+if [ $? -eq 0 ]; then
+ echo "You already have a group \"${GROUP}\", so we will use it."
+else
+ RES=`pw groupshow -g ${GROUP_ID} 2>/dev/null`
+ if [ $? -ne 0 ]; then
+ _GID="-g ${GROUP_ID}"
+ else
+ _GID=''
+ fi
+
+ if pw groupadd -n ${GROUP} ${_GID}; then
+ echo "Added group \"${GROUP}\"."
+ else
+ echo "Adding group \"${GROUP}\" failed..."
+ exit 1
+ fi
+fi
+
+RES=`id -u ${USER} 2>/dev/null`
+if [ $? -ne 0 ]; then
+ RES=`id -un ${USER_ID} 2>/dev/null`
+ if [ $? -ne 0 ]; then
+ _UID="-u ${USER_ID}"
+ else
+ _UID=''
+ fi
+
+ if pw useradd -n ${USER} ${_UID} -g ${GROUP} \
+ -w no -s /usr/sbin/nologin; then
+ echo "Added user \"${USER}\"."
+ else
+ echo "Adding user \"${USER}\" failed..."
+ exit 1
+ fi
+fi
+
+;;
+
+POST-INSTALL)
+
+for DIR in ${RUNTIME_DIRS}; do
+ mkdir -p ${DIR}
+ chown -R ${USER}:${GROUP} ${DIR}
+ chmod -R 755 ${DIR}
+done
+
+;;
+
+DEINSTALL)
+
+if [ -z ${UPGRADE_PORT} ] ; then
+
+ echo
+ echo "If you do not intend to reinstall \"%%PORTNAME%%\" you should manually"
+ echo "remove user '${USER}' (uid='${USER_ID}') and group '${GROUP}' (gid='${USER_ID}')."
+ echo
+ echo "Also you may want to remove the no longer required directoris:"
+ echo ${RUNTIME_DIRS}
+ echo
+
+fi
+
+esac
diff --git a/databases/redis-devel/files/pkg-message.in b/databases/redis-devel/files/pkg-message.in
new file mode 100644
index 000000000000..fd3763137ea3
--- /dev/null
+++ b/databases/redis-devel/files/pkg-message.in
@@ -0,0 +1,8 @@
+
+===> CONFIGURATION NOTE:
+
+ To setup "%%PORTNAME%%" you need to edit the configuration file:
+ %%PREFIX%%/etc/%%PORTNAME%%.conf
+
+ To run redis from startup, add %%PORTNAME%%_enable="YES"
+ in your /etc/rc.conf.
diff --git a/databases/redis-devel/files/redis.sh.in b/databases/redis-devel/files/redis.sh.in
new file mode 100644
index 000000000000..27c3b8d08fbd
--- /dev/null
+++ b/databases/redis-devel/files/redis.sh.in
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: redis
+# REQUIRE: LOGIN
+# BEFORE: securelevel
+# KEYWORD: shutdown
+
+# Add the following line to /etc/rc.conf to enable `redis':
+#
+#redis_enable="YES"
+#
+
+. "%%RC_SUBR%%"
+
+name="redis"
+rcvar=`set_rcvar`
+
+extra_commands="reload"
+
+command="%%PREFIX%%/bin/redis-server"
+config_file="%%PREFIX%%/etc/$name.conf"
+command_args="${config_file}"
+pidfile="%%REDIS_RUNDIR%%/$name.pid"
+required_files="${config_file}"
+
+# read configuration and set defaults
+load_rc_config "$name"
+: ${redis_enable="NO"}
+: ${redis_user="%%REDIS_USER%%"}
+: ${redis_flags=""}
+
+run_rc_command "$1"
diff --git a/databases/redis-devel/pkg-descr b/databases/redis-devel/pkg-descr
new file mode 100644
index 000000000000..81dd3e5bdd3b
--- /dev/null
+++ b/databases/redis-devel/pkg-descr
@@ -0,0 +1,14 @@
+Redis is a key-value database. It is similar to memcached but the
+dataset is not volatile, and values can be strings, exactly like in
+memcached, but also lists and sets with atomic operations to push/pop
+elements.
+
+In order to be very fast but at the same time persistent the whole
+dataset is taken in memory and from time to time and/or when a number of
+changes to the dataset are performed it is written asynchronously on
+disk. You may lost the last few queries that is acceptable in many
+applications but it is as fast as an in memory DB (Redis supports
+non-blocking master-slave replication in order to solve this problem by
+redundancy).
+
+WWW: http://code.google.com/p/redis/
diff --git a/databases/redis-devel/pkg-plist b/databases/redis-devel/pkg-plist
new file mode 100644
index 000000000000..3f7c08dc7eee
--- /dev/null
+++ b/databases/redis-devel/pkg-plist
@@ -0,0 +1,6 @@
+bin/redis-server
+bin/redis-benchmark
+bin/redis-cli
+@unexec (cmp -s %D/etc/redis.conf %D/etc/redis.conf.sample && rm -f %D/etc/redis.conf) || true
+etc/redis.conf.sample
+@exec [ -f %B/redis.conf ] || cp %B/%f %B/redis.conf