s3-selftest: fix testparm tests as non-root.
[amitay/samba.git] / source3 / script / build_env.sh
1 #!/bin/sh
2
3 if [ $# -lt 3 ]
4 then
5     echo "Usage: $0 srcdir builddir compiler"
6     exit 1
7 fi
8
9 uname=`uname -a`
10 date=`date`
11 srcdir=$1
12 builddir=$2
13 compiler=$3
14
15 if [ ! "x$USER" = "x" ]; then
16     whoami=$USER
17 else 
18     if [ ! "x$LOGNAME" = "x" ]; then
19         whoami=$LOGNAME
20     else
21         whoami=`whoami || id -un`
22     fi
23 fi
24
25 host=`hostname`
26
27 cat <<EOF
28 /* This file is automatically generated with "make include/build_env.h". DO NOT EDIT */
29
30 #ifndef _BUILD_ENV_H
31 #define _BUILD_ENV_H
32
33 #define BUILD_ENV_UNAME "${uname}"
34 #define BUILD_ENV_DATE "${date}"
35 #define BUILD_ENV_SRCDIR "${srcdir}"
36 #define BUILD_ENV_BUILDDIR "${builddir}"
37 #define BUILD_ENV_USER "${whoami}"
38 #define BUILD_ENV_HOST "${host}"
39 #define BUILD_ENV_COMPILER "${compiler}"
40 #endif /* _BUILD_ENV_H */
41 EOF