summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <mkraai@beckman.com>2009-09-17 07:07:42 -0700
committerBjörn Jacke <bj@sernet.de>2009-10-11 12:44:42 +0200
commit815b790c96c72cb995c983bbbc3cc95801aaacaa (patch)
tree56ac2878283bcdf8a0b67836c6fae67ae28bb6c2
parent622bffce4723353964bf0dc7bbf60235e417caa6 (diff)
downloadsamba-815b790c96c72cb995c983bbbc3cc95801aaacaa.tar.gz
samba-815b790c96c72cb995c983bbbc3cc95801aaacaa.tar.bz2
samba-815b790c96c72cb995c983bbbc3cc95801aaacaa.zip
Use the method used by build_env.sh to discover the user name.
so try USERNAME, then LOGNAME, then whoami, then id -un to find out who we are.
-rwxr-xr-xsource3/script/tests/selftest.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index ae856ca31e..43e7bf1731 100755
--- a/source3/script/tests/selftest.sh
+++ b/source3/script/tests/selftest.sh
@@ -57,7 +57,15 @@ export TORTURE_MAXTIME
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