-
Notifications
You must be signed in to change notification settings - Fork 0
/
makever.sh
executable file
·56 lines (43 loc) · 1.73 KB
/
makever.sh
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
45
46
47
48
49
50
51
52
53
54
55
56
#!/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
VERSION="2"
REVISION="20c"
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 [ "$system" = "" ]; then system="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
echo "#define VERSION \"$VERSION\"" >> version.h
echo "#define REVISION \"$REVISION\"" >> version.h
echo "#ifdef IS_MAIN" >> version.h
echo "static char version[] = \"\$Revision: $VERSION.$REVISION \$\";"\
>> version.h
echo "#endif" >> version.h
echo "Machine type is $machine, OS name is $system"