pkgsrc-wip/riak/patches/patch-rel__files__riak-admin
2012-08-10 17:16:54 +00:00

38 lines
1.3 KiB
Text

$NetBSD: patch-rel__files__riak-admin,v 1.3 2012/08/10 17:16:54 fhajny Exp $
Substitute whoami for id across SunOS platforms.
Silence sudo (unneeded screen waste).
--- rel/files/riak-admin.orig 2012-08-06 22:02:45.000000000 +0000
+++ rel/files/riak-admin
@@ -11,6 +11,12 @@ if [ `uname -s` = 'SunOS' -a "${POSIX_SH
fi
unset POSIX_SHELL # clear it so if we invoke other scripts, they run as ksh as well
+if [ `uname -s` = 'SunOS' ]; then
+ WHOAMI_PROG="/usr/xpg4/bin/id -un"
+else
+ WHOAMI_PROG="whoami"
+fi
+
RUNNER_SCRIPT_DIR={{runner_script_dir}}
RUNNER_SCRIPT=${0##*/}
@@ -20,7 +26,7 @@ RUNNER_LIB_DIR={{platform_lib_dir}}
RUNNER_LOG_DIR={{runner_log_dir}}
RUNNER_USER={{runner_user}}
-WHOAMI=$(whoami)
+WHOAMI=$(${WHOAMI_PROG})
# Make sure this script is running as the appropriate user
if ([ "$RUNNER_USER" ] && [ "x$WHOAMI" != "x$RUNNER_USER" ]); then
@@ -29,8 +35,7 @@ if ([ "$RUNNER_USER" ] && [ "x$WHOAMI" !
echo "sudo doesn't appear to be installed and your EUID isn't $RUNNER_USER" 1>&2
exit 1
fi
- echo "Attempting to restart script through sudo -H -u $RUNNER_USER"
- 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