From f6677d1e307e94a282b3a0194e30785ea88c09bb Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Mon, 19 May 2014 11:55:34 +0000 Subject: glusterd/geo-rep: Use getent passwd instead of $HOME $HOME might not be set in the env variables, as is the case when these scripts are executed using the runner framework. Hence using getent passwd instead of $HOME Change-Id: I99f6bcd788d727be534b3040600d66c8dbb7ee92 BUG: 1099041 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/7803 Reviewed-by: Atin Mukherjee Reviewed-by: Kotresh HR Tested-by: Gluster Build System Reviewed-by: Venky Shankar Tested-by: Venky Shankar --- geo-replication/src/peer_add_secret_pub.in | 4 ++-- geo-replication/src/set_geo_rep_pem_keys.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'geo-replication') diff --git a/geo-replication/src/peer_add_secret_pub.in b/geo-replication/src/peer_add_secret_pub.in index 04dee1b1ea1..aed93991e58 100644 --- a/geo-replication/src/peer_add_secret_pub.in +++ b/geo-replication/src/peer_add_secret_pub.in @@ -1,9 +1,9 @@ #!/bin/bash if [ "$1" == "" ]; then - home_dir=`echo $HOME` + home_dir=`getent passwd root | cut -d ':' -f 6`; else - home_dir=`getent passwd | grep $1 | cut -d ':' -f 6`; + home_dir=`getent passwd $1 | cut -d ':' -f 6`; fi if [ "$home_dir" == "" ]; then diff --git a/geo-replication/src/set_geo_rep_pem_keys.sh b/geo-replication/src/set_geo_rep_pem_keys.sh index 16c55ed0a49..7a7bcad25c2 100755 --- a/geo-replication/src/set_geo_rep_pem_keys.sh +++ b/geo-replication/src/set_geo_rep_pem_keys.sh @@ -20,7 +20,7 @@ function main() exit 1; fi - home_dir=`getent passwd | grep $user | cut -d ':' -f 6`; + home_dir=`getent passwd $user | cut -d ':' -f 6`; if [ "$home_dir" == "" ]; then echo "No user $user found" -- cgit