xref: /src/contrib/sendmail/cf/sh/makeinfo.sh (revision 6a2f2ff3e97764c1cd1fcac53cd4255791036bf4)
1#!/bin/sh
2#
3# Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
4#	All rights reserved.
5# Copyright (c) 1983 Eric P. Allman.  All rights reserved.
6# Copyright (c) 1988, 1993
7#	The Regents of the University of California.  All rights reserved.
8#
9# By using this file, you agree to the terms and conditions set
10# forth in the LICENSE file which can be found at the top level of
11# the sendmail distribution.
12#
13#
14#	$Id: makeinfo.sh,v 1.1.1.3 2000/08/12 21:55:41 gshapiro Exp $
15#
16
17usewhoami=0
18usehostname=0
19for p in `echo $PATH | sed 's/:/ /g'`
20do
21	if [ "x$p" = "x" ]
22	then
23		p="."
24	fi
25	if [ -f $p/whoami ]
26	then
27		usewhoami=1
28		if [ $usehostname -ne 0 ]
29		then
30			break;
31		fi
32	fi
33	if [ -f $p/hostname ]
34	then
35		usehostname=1
36		if [ $usewhoami -ne 0 ]
37		then
38			break;
39		fi
40	fi
41done
42if [ $usewhoami -ne 0 ]
43then
44	user=`whoami`
45else
46	user=$LOGNAME
47fi
48
49if [ $usehostname -ne 0 ]
50then
51	host=`hostname`
52else
53	host=`uname -n`
54fi
55echo '#####' built by $user@$host on `date`
56echo '#####' in `pwd` | sed 's/\/tmp_mnt//'
57echo '#####' using $1 as configuration include directory | sed 's/\/tmp_mnt//'
58echo "define(\`__HOST__', $host)dnl"
59