Use the method used by build_env.sh to discover the user name.
authorMatt Kraai <mkraai@beckman.com>
Thu, 17 Sep 2009 14:07:42 +0000 (07:07 -0700)
committerBjörn Jacke <bj@sernet.de>
Sun, 11 Oct 2009 10:44:42 +0000 (12:44 +0200)
so try USERNAME, then LOGNAME, then whoami, then id -un to find out who we
are.

source3/script/tests/selftest.sh

index ae856ca31e0b36d17f84012af749311cf3ec4e6b..43e7bf173181b0886194efc788e6003714438b48 100755 (executable)
@@ -57,7 +57,15 @@ export TORTURE_MAXTIME
 WORKGROUP=SAMBA-TEST
 SERVER=localhost2
 SERVER_IP=127.0.0.2
 WORKGROUP=SAMBA-TEST
 SERVER=localhost2
 SERVER_IP=127.0.0.2
-USERNAME=`PATH=/usr/ucb:$PATH whoami`
+if [ ! "x$USER" = "x" ]; then
+    USERNAME=$USER
+else
+    if [ ! "x$LOGNAME" = "x" ]; then
+        USERNAME=$LOGNAME
+    else
+        USERNAME=`PATH=/usr/ucb:$PATH whoami || id -un`
+    fi
+fi
 USERID=`PATH=/usr/ucb:$PATH id | cut -d ' ' -f1 | sed -e 's/uid=\([0-9]*\).*/\1/g'`
 GROUPID=`PATH=/usr/ucb:$PATH id | cut -d ' ' -f2 | sed -e 's/gid=\([0-9]*\).*/\1/g'`
 PASSWORD=test
 USERID=`PATH=/usr/ucb:$PATH id | cut -d ' ' -f1 | sed -e 's/uid=\([0-9]*\).*/\1/g'`
 GROUPID=`PATH=/usr/ucb:$PATH id | cut -d ' ' -f2 | sed -e 's/gid=\([0-9]*\).*/\1/g'`
 PASSWORD=test