ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [1/2] git commit: ARGUS-119: Fix for Argus policy admin installation issue in SUSE linux
Date Fri, 17 Oct 2014 07:41:42 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/master 920814bae -> 48e3730f0


ARGUS-119: Fix for Argus policy admin installation issue in SUSE linux

Project: http://git-wip-us.apache.org/repos/asf/incubator-argus/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-argus/commit/8bb34f22
Tree: http://git-wip-us.apache.org/repos/asf/incubator-argus/tree/8bb34f22
Diff: http://git-wip-us.apache.org/repos/asf/incubator-argus/diff/8bb34f22

Branch: refs/heads/master
Commit: 8bb34f22c77185c36b04137b9d7a43d3d6ee7a3f
Parents: 31801c0
Author: mneethiraj <mneethiraj@hortonworks.com>
Authored: Fri Oct 17 00:40:54 2014 -0700
Committer: mneethiraj <mneethiraj@hortonworks.com>
Committed: Fri Oct 17 00:40:54 2014 -0700

----------------------------------------------------------------------
 security-admin/scripts/install.sh | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/8bb34f22/security-admin/scripts/install.sh
----------------------------------------------------------------------
diff --git a/security-admin/scripts/install.sh b/security-admin/scripts/install.sh
index dec3da7..100546c 100755
--- a/security-admin/scripts/install.sh
+++ b/security-admin/scripts/install.sh
@@ -40,6 +40,14 @@ check_ret_status(){
 	fi
 }
 
+check_ret_status_for_groupadd(){
+# 9 is the response if the group exists
+    if [ $1 -ne 0 ] && [ $1 -ne 9 ]; then
+        log "[E] $2";
+        exit 1;
+    fi
+}
+
 is_command () {
     log "[I] check if command $1 exists"
     type "$1" >/dev/null 
@@ -1107,20 +1115,19 @@ setup_unix_user_group(){
 
 	log "[I] Setting up UNIX user : ${unix_user} and group: ${unix_group}";
 
-	id -g ${unix_group} > /dev/null 2>&1
-
-	if [ $? -ne 0 ]
-	then
-		groupadd ${unix_group}
-		check_ret_status $? "Creating group ${unix_group} failed"
-	fi
+    groupadd ${unix_group}
+    check_ret_status_for_groupadd $? "Creating group ${unix_group} failed"
 
 	id -u ${unix_user} > /dev/null 2>&1
 
 	if [ $? -ne 0 ]
 	then
+	    log "[I] Creating new user and adding to group";
         useradd ${unix_user} -g ${unix_group} -m
 		check_ret_status $? "useradd ${unix_user} failed"
+	else
+	    log "[I] User already exists, adding it to group";
+	    usermod -g ${unix_group} ${unix_user}
 	fi
 
 	log "[I] Setting up UNIX user : ${unix_user} and group: ${unix_group} DONE";


Mime
View raw message