Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Create patches for SmartOS packages to handle differing behavior #65

Merged
merged 1 commit into from

1 participant

@jaredmorrow

SmartOS treats sudo and ulimit different than other OS's so
we patch both the runner and env.sh scripts to account for these
changes.

This brings node_package to complete feature parity of Riak's
packaging on SmartOS.

@jaredmorrow jaredmorrow Create patches for SmartOS packages to handle differing behavior
SmartOS treats sudo and ulimit different than other OS's so
we patch both the runner and env.sh scripts to account for these
changes.

This brings node_package to complete feature parity of Riak's
packaging on SmartOS.
69ae305
@jaredmorrow jaredmorrow merged commit 6fb09aa into master
@jaredmorrow jaredmorrow deleted the jem-smartos-runner-patches branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 25, 2013
  1. @jaredmorrow

    Create patches for SmartOS packages to handle differing behavior

    jaredmorrow authored
    SmartOS treats sudo and ulimit different than other OS's so
    we patch both the runner and env.sh scripts to account for these
    changes.
    
    This brings node_package to complete feature parity of Riak's
    packaging on SmartOS.
This page is out of date. Refresh to see the latest.
View
16 priv/templates/smartos/Makefile
@@ -205,7 +205,7 @@ templates: $(BUILD_STAGE_DIR)
# file so the directories are created in the +INSTALL script
# We copy the data and log directories if they exist to make
# scanning them easier later
-$(BUILD_STAGE_DIR): buildrel
+$(BUILD_STAGE_DIR): buildrel patch_runner
@echo "Copying rel directory to staging directory"
mkdir -p $@
cp -R $(BUILDDIR)/rel/{{package_install_name}} $(BUILD_STAGE_DIR)
@@ -235,11 +235,21 @@ smartos_check:
$(if $(NCURSES_DEP),,$(error "Unsupported SmartOS version, please add to github.com/basho/node_package"))
@echo "Building for pkgsrc version $(PKGSRC_VERSION)"
+# Patch the runner script with SmartOS modifications
+patch_runner: buildrel
+ cp $(PKGERDIR)/runner.patch $(BUILDDIR)/rel/{{package_install_name}}/bin/
+ cp $(PKGERDIR)/env.patch $(BUILDDIR)/rel/{{package_install_name}}/lib/
+ cd $(BUILDDIR)/rel/{{package_install_name}}/bin && \
+ patch -p0 {{package_install_name}} runner.patch
+ rm $(BUILDDIR)/rel/{{package_install_name}}/bin/runner.patch
+ cd $(BUILDDIR)/rel/{{package_install_name}}/lib && \
+ patch -p0 env.sh env.patch
+ rm $(BUILDDIR)/rel/{{package_install_name}}/lib/env.patch
+
+
# 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
-# TODO, solve the .patch issue we have in riak
buildrel: $(BUILDDIR) smartos_check
OVERLAY_VARS="overlay_vars=../smartos/vars.config" $(MAKE) deps rel
chmod 0755 $(BUILDDIR)/rel/{{package_install_name}}/bin/* $(BUILDDIR)/rel/{{package_install_name}}/erts-*/bin/*
View
4 priv/templates/smartos/env.patch
@@ -0,0 +1,4 @@
+169c169
+< exec sudo -H -u $RUNNER_USER -i $RUNNER_SCRIPT_DIR/$RUNNER_SCRIPT $@
+---
+> exec sudo -H -u $RUNNER_USER $RUNNER_SCRIPT_DIR/$RUNNER_SCRIPT $@
View
2  priv/templates/smartos/manifest131.xml
@@ -20,7 +20,7 @@
<envvar name="LOGNAME" value="{{package_install_user}}" />
<envvar name="PATH" value="/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/sbin" />
<envvar name="LD_PRELOAD_32" value="/lib/libumem.so.1" />
- <envvar name="LD_PRELOAD_64" value="/lib/amd64/libumem.so.1:/opt/local/gcc47/lib/amd64/libgcc_s.so.1"/>
+ <envvar name="LD_PRELOAD_64" value="/lib/amd64/libumem.so.1:/opt/local/gcc47/x86_64-sun-solaris2.11/lib/amd64/libgcc_s.so.1"/>
<envvar name="UMEM_OPTIONS" value="allocator=best" />
</method_environment>
</method_context>
View
89 priv/templates/smartos/patches/rel-files.patch
@@ -1,89 +0,0 @@
-diff --git a/rel/files/riak b/rel/files/riak
-index 4c5a5d1..80b470b 100755
---- a/rel/files/riak
-+++ b/rel/files/riak
-@@ -37,7 +37,7 @@ if ([ "$RUNNER_USER" ] && [ "x$WHOAMI" != "x$RUNNER_USER" ]); then
- exit 1
- fi
- echo "Attempting to restart script through sudo -H -u $RUNNER_USER" >&2
-- exec sudo -H -u $RUNNER_USER -i $RUNNER_SCRIPT_DIR/$RUNNER_SCRIPT $@
-+ exec sudo -H -u $RUNNER_USER $RUNNER_SCRIPT_DIR/$RUNNER_SCRIPT $@
- fi
-
- # Warn the user if ulimit -n is less than 1024
-@@ -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)
-@@ -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"
-diff --git a/rel/files/riak-admin b/rel/files/riak-admin
-index 7c37dc1..ec5bbb9 100755
---- a/rel/files/riak-admin
-+++ b/rel/files/riak-admin
-@@ -30,7 +30,7 @@ if ([ "$RUNNER_USER" ] && [ "x$WHOAMI" != "x$RUNNER_USER" ]); then
- exit 1
- fi
- echo "Attempting to restart script through sudo -H -u $RUNNER_USER" >&2
-- exec sudo -H -u $RUNNER_USER -i $RUNNER_SCRIPT_DIR/$RUNNER_SCRIPT $@
-+ exec sudo -H -u $RUNNER_USER $RUNNER_SCRIPT_DIR/$RUNNER_SCRIPT $@
- fi
-
- # Make sure CWD is set to runner base dir
-diff --git a/rel/files/search-cmd b/rel/files/search-cmd
-index a82af01..d9798f4 100755
---- a/rel/files/search-cmd
-+++ b/rel/files/search-cmd
-@@ -25,7 +25,7 @@ if [ "$RUNNER_USER" -a "x$LOGNAME" != "x$RUNNER_USER" ]; then
- exit 1
- fi
- echo "Attempting to restart script through sudo -H -u $RUNNER_USER" >&2
-- exec sudo -H -u $RUNNER_USER -i $RUNNER_SCRIPT_DIR/$RUNNER_SCRIPT $@
-+ exec sudo -H -u $RUNNER_USER $RUNNER_SCRIPT_DIR/$RUNNER_SCRIPT $@
- fi
-
- # Make sure CWD is set to runner base dir
View
40 priv/templates/smartos/runner.patch
@@ -0,0 +1,40 @@
+54a55
+>
+57a59,64
+> if [ "${SMF_METHOD}" != "start" ]; then
+> echo "***"
+> echo "Warning: please use 'svcadm enable $SCRIPT' instead"
+> echo "***"
+> fi
+>
+68,69c75,81
+< # Warn the user if ulimit is too low
+< check_ulimit
+---
+> # 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
+116a129
+>
+119a133,138
+> if [ "${SMF_METHOD}" != "stop" ]; then
+> echo "***"
+> echo "Warning: please use 'svcadm disable $SCRIPT' instead"
+> echo "***"
+> fi
+>
+226,227c245,251
+< # Warn the user if ulimit -n is less than the defined threshold
+< check_ulimit
+---
+> # 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
View
4 priv/templates/smartos/smartos.template
@@ -27,7 +27,9 @@
{template, "+DISPLAY", "+DISPLAY"}.
{template, "+INSTALL", "+INSTALL"}.
{template, "epmd-manifest.xml", "epmd-manifest.xml"}.
-{template, "manifest16.xml", "manifest.xml"}.
+{template, "manifest16.xml", "manifest16.xml"}.
{template, "manifest18.xml", "manifest18.xml"}.
{template, "manifest131.xml", "manifest131.xml"}.
{template, "epmd", "epmd"}.
+{template, "runner.patch", "runner.patch"}.
+{template, "env.patch", "env.patch"}.
Something went wrong with that request. Please try again.