aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--GIDs1
-rw-r--r--UIDs1
-rw-r--r--databases/Makefile1
-rw-r--r--databases/riak/Makefile99
-rw-r--r--databases/riak/distinfo2
-rw-r--r--databases/riak/files/patch-deps-eleveldb-c_src-leveldb-build_detect_platform31
-rw-r--r--databases/riak/files/patch-deps-eleveldb-c_src-leveldb-db-version_set.cc34
-rw-r--r--databases/riak/files/patch-deps-erlang_js-c_src-patches-js-src-config-FreeBSD.mk.patch18
-rw-r--r--databases/riak/files/patch-deps-node_package-priv-base-env.sh27
-rw-r--r--databases/riak/files/patch-rel-reltool.config16
-rw-r--r--databases/riak/files/patch-rel-vars.config41
-rw-r--r--databases/riak/files/riak.in84
-rw-r--r--databases/riak/pkg-descr6
-rw-r--r--databases/riak/pkg-plist23
14 files changed, 384 insertions, 0 deletions
diff --git a/GIDs b/GIDs
index b5ac1a0c53ec..88d8f1601a90 100644
--- a/GIDs
+++ b/GIDs
@@ -188,6 +188,7 @@ _pkcs11:*:602:_pkcs11
freeswitch:*:610:
monkeysphere:*:641:
aox:*:666:
+riak:*:667:
bnetd:*:700:
bopm:*:717:
openxpki:*:777:
diff --git a/UIDs b/UIDs
index 6bc54909f6d4..4c8010ebc7ec 100644
--- a/UIDs
+++ b/UIDs
@@ -196,6 +196,7 @@ freeswitch:*:610:610::0:0:Freeswitch user:/nonexistent:/usr/sbin/nologin
_pla:*:636:80::0:0:phpLDAPAdmin Owner:/nonexistent:/usr/sbin/nologin
monkeysphere:*:641:641::0:0:Monkeysphere User:/var/monkeysphere:/usr/local/bin/bash
aox:*:666:666::0:0:Archiveopteryx user:/nonexistent:/usr/sbin/nologin
+riak:*:667:667::0:0:Riak user:/usr/local/lib/riak:/bin/sh
bnetd:*:700:700::0:0:Bnetd user:/nonexistent:/usr/sbin/nologin
bopm:*:717:717::0:0:Blitzed Open Proxy Monitor:/nonexistent:/bin/sh
openxpki:*:777:777::0:0:OpenXPKI Owner:/nonexistent:/usr/sbin/nologin
diff --git a/databases/Makefile b/databases/Makefile
index 0581937ab034..81c41dc2745f 100644
--- a/databases/Makefile
+++ b/databases/Makefile
@@ -806,6 +806,7 @@
SUBDIR += redigo
SUBDIR += redis
SUBDIR += redis-devel
+ SUBDIR += riak
SUBDIR += rrdman
SUBDIR += rrdmerge
SUBDIR += rrdtool
diff --git a/databases/riak/Makefile b/databases/riak/Makefile
new file mode 100644
index 000000000000..4e477f7c2984
--- /dev/null
+++ b/databases/riak/Makefile
@@ -0,0 +1,99 @@
+# $FreeBSD$
+
+PORTNAME= riak
+PORTVERSION= 1.4.2
+CATEGORIES= databases
+MASTER_SITES= http://s3.amazonaws.com/downloads.basho.com/riak/${PORTVERSION:R}/${PORTVERSION}/ \
+ http://downloads.basho.com.s3.amazonaws.com/riak/${PORTVERSION:R}/${PORTVERSION}/
+
+MAINTAINER= ports@robakdesign.com
+COMMENT= Riak is an open source, distributed database
+
+BUILD_DEPENDS= ${LOCALBASE}/lib/erlang15/bin/erlc:${PORTSDIR}/lang/erlang-runtime15
+
+USES= gmake
+USE_RC_SUBR= riak
+
+PLIST= ${WRKDIR}/pkg-plist
+PLIST_SUB+= RIAK_LOGDIR=${RIAK_LOGDIR} \
+ RIAK_DBDIR=${RIAK_DBDIR} \
+ RIAK_CONFDIR=${RIAK_CONFDIR} \
+ RIAK_HOMEDIR=${RIAK_HOMEDIR}
+
+USERS= riak
+GROUPS= riak
+
+RIAK_CONFDIR?= ${PREFIX}/etc/${PORTNAME}
+RIAK_LOGDIR?= /var/log/${PORTNAME}
+RIAK_DBDIR?= /var/db/${PORTNAME}
+RIAK_LIBDIR?= ${PREFIX}/lib/${PORTNAME}/lib
+RIAK_HOMEDIR?= ${PREFIX}/lib/${PORTNAME}
+
+MAN1= riak.1 riak-admin.1 riak-debug.1 search-cmd.1
+MANCOMPRESSED= yes
+
+ALL_TARGET= rel
+MAKE_JOBS_UNSAFE=yes
+MAKE_ENV= PATH=${LOCALBASE}/lib/erlang15/bin:${PATH}
+NO_STAGE= yes
+
+pre-install:
+ ${RM} -f ${PLIST}
+ ${CAT} ${PKGDIR}/pkg-plist >> ${PLIST}
+ cd ${WRKSRC}/rel/${PORTNAME}; ${FIND} releases -type f \
+ | ${AWK} '{print length, $$0}' | ${SORT} -rn | ${SED} -e 's/^/lib\//' \
+ | ${AWK} '{print "lib/riak/"$$2 }' >> ${PLIST}
+ cd ${WRKSRC}/rel/${PORTNAME}; ${FIND} erts-* -type f \
+ | ${AWK} '{print length, $$0}' | ${SORT} -rn \
+ | ${AWK} '{print "lib/riak/"$$2 }' >> ${PLIST}
+ cd ${WRKSRC}/rel; ${FIND} ${PORTNAME}/lib -type f \
+ | ${AWK} '{print length, $$0}' | ${SORT} -rn | ${SED} -e 's/^/lib\//' \
+ | ${AWK} '{print "lib/"$$2 }' >> ${PLIST}
+ cd ${WRKSRC}/rel/${PORTNAME}; ${FIND} releases -type d \
+ | ${AWK} '{print length, $$0}' | ${SORT} -rn | ${SED} -e 's/^/lib\//' \
+ | ${AWK} '{print "lib/riak/"$$2 }' | ${SED} -e "s/^/@dirrm\ /" >> ${PLIST}
+ cd ${WRKSRC}/rel/${PORTNAME}; ${FIND} erts-* -type d \
+ | ${AWK} '{print length, $$0}' | ${SORT} -rn | ${SED} -e 's/^/lib\//' \
+ | ${AWK} '{print "lib/riak/"$$2 }' | ${SED} -e "s/^/@dirrm\ /" >> ${PLIST}
+ cd ${WRKSRC}/rel; ${FIND} ${PORTNAME}/lib -type d \
+ | ${AWK} '{print length, $$0}' | ${SORT} -rn | ${SED} -e 's/^/lib\//' \
+ | ${AWK} '{print "lib/"$$2 }' | ${SED} -e "s/^/@dirrm\ /" >> ${PLIST}
+ ${ECHO} "@dirrm lib/riak" >> ${PLIST}
+ ${ECHO} "@cwd /" >> ${PLIST}
+ ${ECHO} "@dirrmtry %%RIAK_DBDIR%%" >> ${PLIST}
+ ${ECHO} "@dirrmtry %%RIAK_LOGDIR%%" >> ${PLIST}
+
+do-install:
+.for d in ${RIAK_CONFDIR} ${RIAK_LOGDIR} ${RIAK_DBDIR} ${RIAK_LIBDIR} ${RIAK_HOMEDIR}
+ [ -d ${d} ] || ${MKDIR} ${d} && ${CHOWN} ${USERS}:${GROUPS} ${d}
+.endfor
+ ${INSTALL_DATA} ${WRKSRC}/rel/riak/etc/vm.args ${RIAK_CONFDIR}/vm.args.sample
+ ${INSTALL_DATA} ${WRKSRC}/rel/riak/etc/app.config ${RIAK_CONFDIR}/app.config.sample
+ ${INSTALL_DATA} ${WRKSRC}/rel/riak/etc/cert.pem ${RIAK_CONFDIR}/cert.pem.sample
+ ${INSTALL_DATA} ${WRKSRC}/rel/riak/etc/key.pem ${RIAK_CONFDIR}/key.pem.sample
+ (cd ${WRKSRC}/rel/riak/lib/ && ${COPYTREE_BIN} . ${RIAK_LIBDIR})
+ (cd ${WRKSRC}/rel/riak/bin/ && ${COPYTREE_BIN} . ${PREFIX}/sbin/)
+ (cd ${WRKSRC}/rel/riak/lib/basho-patches && ${COPYTREE_SHARE} . ${RIAK_LIBDIR}/basho-patches)
+ (cd ${WRKSRC}/rel/riak/releases && ${COPYTREE_SHARE} . ${RIAK_HOMEDIR}/releases)
+ ${CP} -R ${WRKSRC}/rel/riak/erts-* ${RIAK_HOMEDIR}
+ ${CHOWN} -R ${USERS}:${GROUPS} ${PREFIX}/lib/${PORTNAME}
+ ${INSTALL_MAN} ${WRKSRC}/doc/man/man1/riak.1.gz ${MANPREFIX}/man/man1/
+ ${INSTALL_MAN} ${WRKSRC}/doc/man/man1/riak-admin.1.gz ${MANPREFIX}/man/man1/
+ ${INSTALL_MAN} ${WRKSRC}/doc/man/man1/riak-debug.1.gz ${MANPREFIX}/man/man1/
+ ${INSTALL_MAN} ${WRKSRC}/doc/man/man1/search-cmd.1.gz ${MANPREFIX}/man/man1/
+
+post-install:
+ @if [ ! -f ${RIAK_CONFDIR}/vm.args ]; then \
+ ${CP} -p ${RIAK_CONFDIR}/vm.args.sample ${RIAK_CONFDIR}/vm.args; \
+ fi
+ @if [ ! -f ${RIAK_CONFDIR}/app.config ]; then \
+ ${CP} -p ${RIAK_CONFDIR}/app.config.sample ${RIAK_CONFDIR}/app.config; \
+ fi
+ @if [ ! -f ${RIAK_CONFDIR}/cert.pem ]; then \
+ ${CP} -p ${RIAK_CONFDIR}/cert.pem.sample ${RIAK_CONFDIR}/cert.pem; \
+ fi
+ @if [ ! -f ${RIAK_CONFDIR}/key.pem ]; then \
+ ${CP} -p ${RIAK_CONFDIR}/key.pem.sample ${RIAK_CONFDIR}/key.pem; \
+ fi
+
+.include <bsd.port.mk>
diff --git a/databases/riak/distinfo b/databases/riak/distinfo
new file mode 100644
index 000000000000..6936ba982b16
--- /dev/null
+++ b/databases/riak/distinfo
@@ -0,0 +1,2 @@
+SHA256 (riak-1.4.2.tar.gz) = 6a1fdcfc1f3f0357eeb377ead6638db4187379e3b40121cef16b517e03c6fd11
+SIZE (riak-1.4.2.tar.gz) = 13738074
diff --git a/databases/riak/files/patch-deps-eleveldb-c_src-leveldb-build_detect_platform b/databases/riak/files/patch-deps-eleveldb-c_src-leveldb-build_detect_platform
new file mode 100644
index 000000000000..942d55f2f1e4
--- /dev/null
+++ b/databases/riak/files/patch-deps-eleveldb-c_src-leveldb-build_detect_platform
@@ -0,0 +1,31 @@
+Don't remove /dev/null on 8.x (see kern/139014)
+-bdrewery 09/27/2013
+--- deps/eleveldb/c_src/leveldb/build_detect_platform.orig 2013-09-27 06:53:42.527133646 -0500
++++ deps/eleveldb/c_src/leveldb/build_detect_platform 2013-09-27 06:54:01.360134865 -0500
+@@ -134,7 +134,7 @@
+ true
+ else
+ # If -std=c++0x works, use <cstdatomic>. Otherwise use port_posix.h.
+- $CXX $CFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <<EOF
++ $CXX $CFLAGS -std=c++0x -x c++ - 2>/dev/null <<EOF
+ #include <cstdatomic>
+ int main() {}
+ EOF
+@@ -147,7 +147,7 @@
+
+ # Test whether Snappy library is installed
+ # http://code.google.com/p/snappy/
+- $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF
++ $CXX $CFLAGS -x c++ - 2>/dev/null <<EOF
+ #include <snappy.h>
+ int main() {}
+ EOF
+@@ -157,7 +157,7 @@
+ fi
+
+ # Test whether tcmalloc is available
+- $CXX $CFLAGS -x c++ - -o /dev/null -ltcmalloc 2>/dev/null <<EOF
++ $CXX $CFLAGS -x c++ - -ltcmalloc 2>/dev/null <<EOF
+ int main() {}
+ EOF
+ if [ "$?" = 0 ]; then
diff --git a/databases/riak/files/patch-deps-eleveldb-c_src-leveldb-db-version_set.cc b/databases/riak/files/patch-deps-eleveldb-c_src-leveldb-db-version_set.cc
new file mode 100644
index 000000000000..8714bc5bda6e
--- /dev/null
+++ b/databases/riak/files/patch-deps-eleveldb-c_src-leveldb-db-version_set.cc
@@ -0,0 +1,34 @@
+--- deps/eleveldb/c_src/leveldb/db/version_set.cc.orig 2013-08-29 23:03:04.000000000 +0200
++++ deps/eleveldb/c_src/leveldb/db/version_set.cc 2013-09-22 14:38:08.000000000 +0200
+@@ -2,10 +2,12 @@
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file. See the AUTHORS file for names of contributors.
+
++#define __STDC_CONSTANT_MACROS
+ #include "db/version_set.h"
+
+ #include <algorithm>
+ #include <stdio.h>
++#include <stdint.h>
+ #include "db/filename.h"
+ #include "db/log_reader.h"
+ #include "db/log_writer.h"
+@@ -53,13 +55,13 @@
+
+ // WARNING: m_OverlappedFiles flags need to match config::kNumOverlapFiles ... until unified
+ {
+- {10485760, 262144000, 57671680, 209715200, 0, 300000000, true},
+- {10485760, 82914560, 57671680, 419430400, 0, 209715200, true},
+- {10485760, 104371840, 57671680, 1006632960, 200000000, 314572800, false},
+- {10485760, 125829120, 57671680, 4094304000, 3355443200, 419430400, false},
+- {10485760, 147286400, 57671680, 41943040000, 33554432000, 524288000, false},
+- {10485760, 188743680, 57671680, 419430400000, 335544320000, 629145600, false},
+- {10485760, 220200960, 57671680, 4194304000000, 3355443200000, 734003200, false}
++ {UINT64_C(10485760), UINT64_C(262144000), INT64_C(57671680), UINT64_C( 209715200), UINT64_C( 0), UINT64_C(300000000), true},
++ {UINT64_C(10485760), UINT64_C( 82914560), INT64_C(57671680), UINT64_C( 419430400), UINT64_C( 0), UINT64_C(209715200), true},
++ {UINT64_C(10485760), UINT64_C(104371840), INT64_C(57671680), UINT64_C( 1006632960), UINT64_C( 200000000), UINT64_C(314572800), false},
++ {UINT64_C(10485760), UINT64_C(125829120), INT64_C(57671680), UINT64_C( 4094304000), UINT64_C( 3355443200), UINT64_C(419430400), false},
++ {UINT64_C(10485760), UINT64_C(147286400), INT64_C(57671680), UINT64_C( 41943040000), UINT64_C( 33554432000), UINT64_C(524288000), false},
++ {UINT64_C(10485760), UINT64_C(188743680), INT64_C(57671680), UINT64_C( 419430400000), UINT64_C( 335544320000), UINT64_C(629145600), false},
++ {UINT64_C(10485760), UINT64_C(220200960), INT64_C(57671680), UINT64_C(4194304000000), UINT64_C(3355443200000), UINT64_C(734003200), false}
+ };
diff --git a/databases/riak/files/patch-deps-erlang_js-c_src-patches-js-src-config-FreeBSD.mk.patch b/databases/riak/files/patch-deps-erlang_js-c_src-patches-js-src-config-FreeBSD.mk.patch
new file mode 100644
index 000000000000..e37e20a60c53
--- /dev/null
+++ b/databases/riak/files/patch-deps-erlang_js-c_src-patches-js-src-config-FreeBSD.mk.patch
@@ -0,0 +1,18 @@
+--- deps/erlang_js/c_src/patches/js-src-config-FreeBSD.mk.patch.orig 2013-01-29 21:13:01.000000000 +0100
++++ deps/erlang_js/c_src/patches/js-src-config-FreeBSD.mk.patch 2013-09-12 14:59:29.000000000 +0200
+@@ -1,6 +1,6 @@
+ --- c_src.orig/js/src/config/FreeBSD.mk 1969-12-31 19:00:00.000000000 -0500
+ +++ c_src/js/src/config/FreeBSD.mk 2011-03-30 20:12:51.000000000 -0400
+-@@ -0,0 +1,99 @@
++@@ -0,0 +1,100 @@
+ +# -*- Mode: makefile -*-
+ +#
+ +# ***** BEGIN LICENSE BLOCK *****
+@@ -46,6 +46,7 @@
+ +
+ +CC ?= gcc
+ +CCC ?= g++
+++LD = $(CC)
+ +CFLAGS += -Wall -Wno-format
+ +OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DHAVE_LOCALTIME_R
+ +
diff --git a/databases/riak/files/patch-deps-node_package-priv-base-env.sh b/databases/riak/files/patch-deps-node_package-priv-base-env.sh
new file mode 100644
index 000000000000..63c53f3a6d78
--- /dev/null
+++ b/databases/riak/files/patch-deps-node_package-priv-base-env.sh
@@ -0,0 +1,27 @@
+--- deps/node_package/priv/base/env.sh.orig 2013-09-13 10:22:32.000000000 +0200
++++ deps/node_package/priv/base/env.sh 2013-09-13 10:27:16.000000000 +0200
+@@ -100,7 +100,7 @@
+ # read/write/delete .pid files during startup/shutdown
+ create_pid_dir() {
+ # Validate RUNNER_USER is set and they have permissions to write to /var/run
+- # Don't continue if we've already sudo'd to RUNNER_USER
++ # Don't continue if we've already su'd to RUNNER_USER
+ if ([ "$RUNNER_USER" ] && [ "x$WHOAMI" != "x$RUNNER_USER" ]); then
+ if [ -w $RUN_DIR ]; then
+ mkdir -p $PID_DIR
+@@ -161,12 +161,12 @@
+ # Validate that the user running the script is the owner of the
+ # RUN_DIR.
+ if ([ "$RUNNER_USER" ] && [ "x$WHOAMI" != "x$RUNNER_USER" ]); then
+- type sudo > /dev/null 2>&1
++ type su > /dev/null 2>&1
+ if [ "$?" -ne 0 ]; then
+- echoerr "sudo doesn't appear to be installed and your EUID isn't $RUNNER_USER" 1>&2
++ echoerr "su doesn't appear to be installed and your EUID isn't $RUNNER_USER" 1>&2
+ exit 1
+ fi
+- exec sudo -H -u $RUNNER_USER -i $RUNNER_SCRIPT_DIR/$RUNNER_SCRIPT $@
++ exec su - $RUNNER_USER -c "$RUNNER_SCRIPT_DIR/$RUNNER_SCRIPT $@"
+ fi
+ }
+
diff --git a/databases/riak/files/patch-rel-reltool.config b/databases/riak/files/patch-rel-reltool.config
new file mode 100644
index 000000000000..dca083c2447c
--- /dev/null
+++ b/databases/riak/files/patch-rel-reltool.config
@@ -0,0 +1,16 @@
+--- rel/reltool.config.orig 2013-09-17 20:53:23.000000000 +0200
++++ rel/reltool.config 2013-09-17 20:55:40.000000000 +0200
+@@ -37,8 +37,12 @@
+ {boot_rel, "riak"},
+ {profile, embedded},
+ {excl_sys_filters, ["^bin/.*",
+- "^erts.*/bin/(dialyzer|typer)"]},
++ "^erts.*/bin/(dialyzer|typer)",
++ "^erts.*/bin/(dialyzer|typer)",
++ "^erts.*/doc",
++ "^erts.*/man"]},
+ {excl_archive_filters, [".*"]},
++ {app, mnesia, [{incl_app_filters, ["ebin/*"]}]},
+ {app, cluster_info, [{incl_cond, include}]},
+ {app, erlang_js, [{incl_cond, include}]},
+ {app, ebloom, []},
diff --git a/databases/riak/files/patch-rel-vars.config b/databases/riak/files/patch-rel-vars.config
new file mode 100644
index 000000000000..9e7d4afee181
--- /dev/null
+++ b/databases/riak/files/patch-rel-vars.config
@@ -0,0 +1,41 @@
+--- rel/vars.config.orig 2013-08-29 20:13:02.000000000 +0200
++++ rel/vars.config 2013-09-11 23:04:34.000000000 +0200
+@@ -2,11 +2,12 @@
+ %% ex: ft=erlang ts=4 sw=4 et
+
+ %% Platform-specific installation paths
+-{platform_bin_dir, "./bin"}.
+-{platform_data_dir, "./data"}.
+-{platform_etc_dir, "./etc"}.
+-{platform_lib_dir, "./lib"}.
+-{platform_log_dir, "./log"}.
++{platform_bin_dir, "/usr/local/sbin"}.
++{platform_data_dir, "/var/db/riak"}.
++{platform_etc_dir, "/usr/local/etc/riak"}.
++{platform_base_dir, "/usr/local/lib/riak"}.
++{platform_lib_dir, "/usr/local/lib/riak/lib"}.
++{platform_log_dir, "/var/log/riak"}.
+
+ %%
+ %% etc/app.config
+@@ -47,12 +48,12 @@
+ %%
+ %% bin/riak
+ %%
+-{runner_script_dir, "$(cd ${0%/*} && pwd)"}.
+-{runner_base_dir, "{{runner_script_dir}}/.."}.
+-{runner_etc_dir, "$RUNNER_BASE_DIR/etc"}.
+-{runner_log_dir, "$RUNNER_BASE_DIR/log"}.
+-{runner_lib_dir, "$RUNNER_BASE_DIR/lib"}.
+-{runner_patch_dir, "$RUNNER_BASE_DIR/lib/basho-patches"}.
+-{pipe_dir, "/tmp/$RUNNER_BASE_DIR/"}.
+-{runner_user, ""}.
++{runner_script_dir, "{{platform_bin_dir}}"}.
++{runner_base_dir, "{{platform_base_dir}}"}.
++{runner_etc_dir, "{{platform_etc_dir}}"}.
++{runner_log_dir, "{{platform_log_dir}}"}.
++{runner_lib_dir, "{{platform_lib_dir}}"}.
++{runner_patch_dir, "{{platform_lib_dir}}/basho-patches"}.
++{pipe_dir, "/tmp/riak"}.
++{runner_user, "riak"}.
+ {runner_wait_process, "riak_core_node_watcher"}.
diff --git a/databases/riak/files/riak.in b/databases/riak/files/riak.in
new file mode 100644
index 000000000000..3fb2f06a3eec
--- /dev/null
+++ b/databases/riak/files/riak.in
@@ -0,0 +1,84 @@
+#!/bin/sh
+# $FreeBSD$
+
+# PROVIDE: riak
+# REQUIRE: LOGIN cleanvar
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable riak:
+# riak_enable (bool): Set to "NO" by default.
+# Set it to "YES" to enable riak on boot.
+#
+
+. /etc/rc.subr
+
+name="riak"
+rcvar=riak_enable
+
+pidfile=/var/run/riak/riak.pid
+
+start_cmd="riak_start"
+stop_cmd="riak_stop"
+restart_cdm="riak_restart"
+status_cmd="riak_status"
+command="/usr/local/sbin/riak"
+
+load_rc_config $name
+
+# Read rc.d config and set defaults
+load_rc_config "$name"
+: ${riak_enable="NO"}
+
+riak_start()
+{
+ echo "Starting Riak."
+ /usr/local/sbin/riak start
+ return 0
+}
+
+riak_stop()
+{
+ echo "Stopping Riak processes"
+ /usr/local/sbin/riak stop
+ killall -9 epmd
+ return 0
+}
+
+riak_restart()
+{
+ riak_stop
+ riak_start
+ return 0
+}
+
+riak_status()
+{
+ if riak_running; then
+ echo "Riak is running."
+ return 0
+ else
+ echo "Riak is not running"
+ return 1
+ fi
+}
+
+riak_running()
+{
+ local pid result ps
+ pid=`/usr/local/sbin/riak getpid`
+ result=`echo $?`
+ if [ "$result" == 0 ]; then
+ ps=`ps -waux | grep ${pid} | grep riak`
+ result=`echo $?`
+ if [ "$result" ]; then
+ return 0
+ else
+ return 1
+ fi
+ else
+ return 1
+ fi
+}
+
+run_rc_command "$1"
diff --git a/databases/riak/pkg-descr b/databases/riak/pkg-descr
new file mode 100644
index 000000000000..7e21a1a13d98
--- /dev/null
+++ b/databases/riak/pkg-descr
@@ -0,0 +1,6 @@
+Riak is a distributed database designed for maximum availability:
+so long as your client can reach one server, it should be able to
+write data. In most failure scenarios the data you want to read
+should be available, albeit possibly stale.
+
+WWW: http://basho.com/riak/
diff --git a/databases/riak/pkg-plist b/databases/riak/pkg-plist
new file mode 100644
index 000000000000..aaa24f84be51
--- /dev/null
+++ b/databases/riak/pkg-plist
@@ -0,0 +1,23 @@
+sbin/riak
+sbin/riak-admin
+sbin/riak-debug
+sbin/search-cmd
+@exec mkdir -p %%RIAK_CONFDIR%%
+@exec mkdir -p %%RIAK_LOGDIR%%
+@exec mkdir -p %%RIAK_DBDIR%%
+@exec mkdir -p %%RIAK_HOMEDIR%%
+@exec mkdir -p %%RIAK_LIBDIR%%
+@unexec if cmp -s %D/%%ETCDIR%%/vm.args.sample %D/%%ETCDIR%%/vm.args; then rm -f %D/%%ETCDIR%%/vm.args; fi
+%%ETCDIR%%/vm.args.sample
+@exec if [ ! -f %D/%%ETCDIR%%/vm.args ] ; then cp -p %D/%F %B/vm.args; fi
+@unexec if cmp -s %D/%%ETCDIR%%/app.config.sample %D/%%ETCDIR%%/app.config; then rm -f %D/%%ETCDIR%%/app.config; fi
+%%ETCDIR%%/app.config.sample
+@exec if [ ! -f %D/%%ETCDIR%%/app.config ] ; then cp -p %D/%F %B/app.config; fi
+@unexec if cmp -s %D/%%ETCDIR%%/cert.pem.sample %D/%%ETCDIR%%/cert.pem; then rm -f %D/%%ETCDIR%%/cert.pem; fi
+%%ETCDIR%%/cert.pem.sample
+@exec if [ ! -f %D/%%ETCDIR%%/cert.pem ] ; then cp -p %D/%F %B/cert.pem; fi
+@unexec if cmp -s %D/%%ETCDIR%%/key.pem.sample %D/%%ETCDIR%%/key.pem; then rm -f %D/%%ETCDIR%%/key.pem; fi
+%%ETCDIR%%/key.pem.sample
+@exec if [ ! -f %D/%%ETCDIR%%/key.pem ] ; then cp -p %D/%F %B/key.pem; fi
+@dirrmtry %%ETCDIR%%
+@unexec if [ -f %%RIAK_HOMEDIR%%/.erlang.cookie ] ; then rm -f %%RIAK_HOMEDIR%%/.erlang.cookie ; fi