Permalink
Browse files

Remove bashisms from shell scripts which use /bin/sh

Fixes #140

`type -p` is not supported by /bin/sh and caused the riak and riak-admin scripts
to think that `sudo` was not available.  In addition `kill -SIGNAL` is not portable
to /bin/sh and should be replaced by `kill -s SIGNAL` instead.

The portability was checked with `checkbashisms` from the devscripts package in
ubuntu 10.04 and was tested on /bin/sh in solaris, ubuntu, and OSX.
  • Loading branch information...
1 parent 713e9fd commit 24176a74757b49df0db96b128fd991004896d8cb Jared Morrow committed May 21, 2012
Showing with 4 additions and 4 deletions.
  1. +2 −2 rel/files/riak
  2. +1 −1 rel/files/riak-admin
  3. +1 −1 rel/files/search-cmd
View
@@ -26,7 +26,7 @@ RIAK_VERSION="git"
# Make sure this script is running as the appropriate user
if [ "$RUNNER_USER" -a "x$LOGNAME" != "x$RUNNER_USER" ]; then
- type -p sudo > /dev/null 2>&1
+ type sudo > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "sudo doesn't appear to be installed and your EUID isn't $RUNNER_USER" 1>&2
exit 1
@@ -171,7 +171,7 @@ case "$1" in
if [ "$ES" -ne 0 ]; then
exit $ES
fi
- while `kill -0 $PID 2>/dev/null`;
+ while `kill -s 0 $PID 2>/dev/null`;
do
sleep 1
done
View
@@ -19,7 +19,7 @@ RUNNER_USER={{runner_user}}
# Make sure this script is running as the appropriate user
if [ "$RUNNER_USER" -a "x$LOGNAME" != "x$RUNNER_USER" ]; then
- type -p sudo > /dev/null 2>&1
+ type sudo > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "sudo doesn't appear to be installed and your EUID isn't $RUNNER_USER" 1>&2
exit 1
View
@@ -19,7 +19,7 @@ RUNNER_USER={{runner_user}}
# Make sure this script is running as the appropriate user
if [ "$RUNNER_USER" -a "x$LOGNAME" != "x$RUNNER_USER" ]; then
- type -p sudo > /dev/null 2>&1
+ type sudo > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "sudo doesn't appear to be installed and your EUID isn't $RUNNER_USER" 1>&2
exit 1

0 comments on commit 24176a7

Please sign in to comment.