Permalink
Browse files

Merge pull request #189 from basho/jem-custom-smartos-scripts

Patch riak script to use SmartOS conventions
  • Loading branch information...
2 parents eced982 + fdcbe7a commit 8d22450c3a9bc01c0a859370098906cd6202d016 Jared Morrow committed Jul 20, 2012
Showing with 67 additions and 0 deletions.
  1. +4 −0 package/smartos/Makefile
  2. +63 −0 package/smartos/patches/rel_riak.patch
@@ -138,12 +138,16 @@ $(BUILD_STAGE_DIR): buildrel
# Build the release we need to package
+# * Patch rel/files/riak with our version
# * Ensure all binaries are executable
# * copy the vars.config over for build config
buildrel: $(BUILD_RIAK_PATH)
cp $(BUILD_RIAK_PATH)/rel/files/riak $(BUILD_RIAK_PATH)/rel/files/riak.tmp
sed -e "s/^RIAK_VERSION.*$$/RIAK_VERSION=\"${VERSIONSTRING}\"/" < \
$(BUILD_RIAK_PATH)/rel/files/riak.tmp > $(BUILD_RIAK_PATH)/rel/files/riak
+ cp $(PKGERDIR)/patches/rel_riak.patch $(BUILD_RIAK_PATH)/rel/files/
+ cd $(BUILD_RIAK_PATH)/rel/files && \
+ patch -p3 < rel_riak.patch
cp -f $(PKGERDIR)/vars.config $(BUILD_RIAK_PATH)/rel/vars.config
$(MAKE) -C $(BUILD_RIAK_PATH) deps rel
chmod 0755 $(BUILD_RIAK_PATH)/rel/riak/bin/* $(BUILD_RIAK_PATH)/rel/riak/erts-*/bin/*
@@ -0,0 +1,63 @@
+diff --git a/rel/files/riak b/rel/files/riak
+index 707bc12..fdfe710 100755
+--- a/rel/files/riak
++++ b/rel/files/riak
+@@ -105,6 +105,21 @@ sed -n '/Begin SSL distribution items/,/End SSL distribution items/p' \
+ # Check the first argument for instructions
+ case "$1" in
+ start)
++
++ if [ "${SMF_METHOD}" != "start" ]; then
++ echo "***"
++ echo "Warning: please use 'svcadm enable riak' instead"
++ echo "***"
++ fi
++
++ # Make sure we have access to enough file descriptors
++ ULIMIT_S=$(prctl -n process.max-file-descriptor -t basic -P $$ | awk '/max-file-descriptor/ { print $3 }')
++ ULIMIT_H=$(prctl -n process.max-file-descriptor -t priv -P $$ | awk '/max-file-descriptor/ { print $3 }')
++ if [ ${ULIMIT_S} -lt ${ULIMIT_H} ]; then
++ echo "Trying to raise the file descriptor limit to maximum allowed."
++ prctl -n process.max-file-descriptor -t basic -v ${ULIMIT_H} $$ || true
++ fi
++
+ # Make sure there is not already a node running
+ RES=`ping_node`
+ if [ "$RES" = "pong" ]; then
+@@ -151,6 +166,12 @@ case "$1" in
+ ;;
+
+ stop)
++ if [ "${SMF_METHOD}" != "stop" ]; then
++ echo "***"
++ echo "Warning: please use 'svcadm disable riak' instead"
++ echo "***"
++ fi
++
+ UNAME_S=`uname -s`
+ case $UNAME_S in
+ Darwin)
+@@ -212,7 +233,7 @@ case "$1" in
+ attach)
+ if [ "$2" = "-f" ]; then
+ echo "Forcing connection..."
+- else
++ else
+ # Make sure a node is running
+ RES=`ping_node`
+ ES=$?
+@@ -227,6 +248,14 @@ case "$1" in
+ ;;
+
+ console)
++ # Make sure we have access to enough file descriptors
++ ULIMIT_S=$(prctl -n process.max-file-descriptor -t basic -P $$ | awk '/max-file-descriptor/ { print $3 }')
++ ULIMIT_H=$(prctl -n process.max-file-descriptor -t priv -P $$ | awk '/max-file-descriptor/ { print $3 }')
++ if [ ${ULIMIT_S} -lt ${ULIMIT_H} ]; then
++ echo "Trying to raise the file descriptor limit to maximum allowed."
++ prctl -n process.max-file-descriptor -t basic -v ${ULIMIT_H} $$ || true
++ fi
++
+ RES=`ping_node`
+ if [ "$RES" = "pong" ]; then
+ echo "Node is already running - use '$SCRIPT attach' instead"

0 comments on commit 8d22450

Please sign in to comment.