xref: /freebsd/contrib/sendmail/cf/sh/makeinfo.sh (revision dd41de95a84d979615a2ef11df6850622bf6184e)
1#!/bin/sh
2#
3# Copyright (c) 1998, 1999 Proofpoint, 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 8.15 2013-11-22 20:51:17 ca Exp $
15#
16# $FreeBSD$
17#
18
19usewhoami=0
20usehostname=0
21for p in `echo $PATH | sed 's/:/ /g'`
22do
23	if [ "x$p" = "x" ]
24	then
25		p="."
26	fi
27	if [ -f $p/whoami ]
28	then
29		usewhoami=1
30		if [ $usehostname -ne 0 ]
31		then
32			break;
33		fi
34	fi
35	if [ -f $p/hostname ]
36	then
37		usehostname=1
38		if [ $usewhoami -ne 0 ]
39		then
40			break;
41		fi
42	fi
43done
44if [ $usewhoami -ne 0 ]
45then
46	user=`whoami`
47else
48	user=$LOGNAME
49fi
50
51if [ $usehostname -ne 0 ]
52then
53	host=`hostname`
54else
55	host=`uname -n`
56fi
57echo '#####' built by $user@$host
58echo '#####' in `pwd` | sed 's/\/tmp_mnt//'
59echo '#####' using $1 as configuration include directory | sed 's/\/tmp_mnt//'
60echo "define(\`__HOST__', $host)dnl"
61