Repository: nifi
Updated Branches:
  refs/heads/master fdef994ea -> 4f7a4e83b


NIFI-1311 Avoid using sudo for nifi.sh commands when run.as is the same as the 
user invoking the script.

Signed-off-by: joewitt <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/4f7a4e83
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/4f7a4e83
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/4f7a4e83

Branch: refs/heads/master
Commit: 4f7a4e83b15f1c36713eafd0c4434b360930a951
Parents: fdef994
Author: Aldrin Piri <[email protected]>
Authored: Fri Dec 18 18:29:31 2015 -0500
Committer: joewitt <[email protected]>
Committed: Sun Jan 10 15:22:45 2016 -0500

----------------------------------------------------------------------
 .../nifi-resources/src/main/resources/bin/nifi.sh            | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/4f7a4e83/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh
index 8863982..2a7da05 100755
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh
@@ -53,8 +53,8 @@ detectOS() {
             os400=true
             ;;
         Darwin)
-                darwin=true
-                ;;
+            darwin=true
+            ;;
     esac
     # For AIX, set an environment variable
     if ${aix}; then
@@ -154,6 +154,10 @@ run() {
     BOOTSTRAP_CONF="${NIFI_HOME}/conf/bootstrap.conf";
 
     run_as=$(grep run.as "${BOOTSTRAP_CONF}" | cut -d'=' -f2)
+    # If the run as user is the same as that starting the process, ignore this 
configuration
+    if [ "$run_as" = "$(whoami)" ]; then
+        unset run_as
+    fi
 
     sudo_cmd_prefix=""
     if $cygwin; then

Reply via email to