]> git.sur5r.net Git - openldap/blob - build/uname.sh
Sync with HEAD (fix global schemadn)
[openldap] / build / uname.sh
1 #!/bin/sh
2 # simple BSD-like uname replacement for those systems without it
3 #
4 # Copyright (c) 1995 The Regents of the University of Michigan
5 #
6
7
8 #
9 # if /bin/uname or /usr/bin/uname exists, just use it
10 # ...unless we are on SCO, where the provided uname is bad
11 #
12 if  [ ! -f /usr/bin/swconfig ]; then
13     if [ -f /bin/uname ]; then
14         exec /bin/uname $*
15     fi
16
17     if [ -f /usr/bin/uname ]; then
18         exec /usr/bin/uname $*
19     fi
20 fi
21
22
23 #
24 # flags to keep track of what to output
25 #
26 PRINT_SYSTEM=0
27 PRINT_VERSION=0
28 PRINT_RELEASE=0
29
30 #
31 # process arguments
32 #
33 USAGE="usage: $0 [-s] [-v] [-r]"
34
35 while [ $# != 0 ]; do
36     case "$1" in
37     -s)
38         PRINT_SYSTEM=1
39         ;;
40     -v)
41         PRINT_VERSION=1
42         ;;
43     -r)
44         PRINT_RELEASE=1
45         ;;
46     *)
47         echo "$USAGE"
48         exit 1
49         ;;
50     esac
51     shift
52 done
53
54
55 #
56 # print system name by default
57 #
58 if [ $PRINT_VERSION = "0" -a $PRINT_RELEASE = "0" ]; then
59     PRINT_SYSTEM=1
60 fi
61
62
63 #
64 # default to unknown everything...
65 #
66 SYSTEM="Unknown-System"
67 VERSION="Unknown-Version"
68 RELEASE="Unknown-Release"
69
70 #
71 # check to see if we are on a machine that runs NextSTEP or SCO
72 #
73 if [ -r /NextApps ]; then
74     SYSTEM="NeXTSTEP"
75 elif [ -f /usr/bin/swconfig ]; then
76     SYSTEM="SCO"
77 fi
78
79
80 #
81 # output requested information
82 #
83 OUTPUT=0
84 if [ $PRINT_SYSTEM = "1" ]; then
85     echo -n "$SYSTEM"
86     OUTPUT=1
87 fi
88
89 if [ $PRINT_VERSION = "1" ]; then
90     if [ $OUTPUT = "1" ]; then
91         echo -n " $VERSION"
92     else
93         echo -n "$VERSION"
94         OUTPUT=1
95     fi
96 fi
97
98 if [ $PRINT_RELEASE = "1" ]; then
99     if [ $OUTPUT = "1" ]; then
100         echo -n " $RELEASE"
101     else
102         echo -n "$RELEASE"
103         OUTPUT=1
104     fi
105 fi
106
107 echo
108
109 exit 0