File: makever.sh

package info (click to toggle)
seyon 2.14c-7
  • links: PTS
  • area: non-free
  • in suites: hamm
  • size: 744 kB
  • ctags: 1,208
  • sloc: ansic: 9,067; makefile: 415; sh: 102; yacc: 91
file content (44 lines) | stat: -rwxr-xr-x 1,486 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh

# Sometimes hostname is broken and exit with nonzero even if it
# succeeds, so this approach is not used.

#host=`hostname || uname -n || echo host` 
#if [ "$USER" != "" ]; then user=$USER
#elif [ "$LOGNAME" != "" ]; then user=$LOGNAME
#elif [ "$LOGNAME" != "" ]; then user=$LOGNAME
#else user="user"
#fi

host=`hostname`
if [ "$host" = "" ]; then host=`uname -n`; fi
if [ "$host" = "" ]; then host=$HOST; fi
if [ "$host" = "" ]; then host="unknown"; fi

user=$USER
if [ "$user" = "" ]; then user=$LOGNAME; fi
if [ "$user" = "" ]; then user=`logname`; fi
if [ "$user" = "" ]; then user="unknown"; fi

system=`uname -s`
if [ "$machine" = "" ]; then machine=$MACHINE; fi
if [ "$machine" = "" ]; then machine="unknown"; fi

machine=`uname -m`
if [ "$machine" = "" ]; then machine=$MACHINE; fi
if [ "$machine" = "" ]; then machine=$HOSTTYPE; fi
if [ "$machine" = "" ]; then machine=$hosttype; fi
if [ "$machine" = "" ]; then machine="unknown"; fi

# This requires bash (ksh and zsh would probably work too), but is not
# supported by the standard sh.

#host=`hostname`; host=${host:-${`uname -n`:-"host"}}
#user=${USER:-${LOGNAME:-${`logname`:-"user"}}}

echo "#define COMPILE_BY \"$user\"" > version.h
echo "#define COMPILE_HOST \"$host\"" >> version.h
echo "#define COMPILE_OSNAME \"$system\"" >> version.h
echo "#define COMPILE_HOSTTYPE \"$machine\"" >> version.h
echo "#define COMPILE_DATE \"`date +%D`\"" >> version.h
echo "#define COMPILE_TIME \"`date +%T`\"" >> version.h