1#!/bin/sh
2
3config_os=$1
4config_release=$2
5uname_machine=$3
6
7uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
8if test $uname_sysname != $config_os; then
9  config_release=`echo $config_os | sed s/$uname_sysname//`
10fi
11
12if test -r /vmunix; then
13  kernel_id=`strings /vmunix | grep UNIX`
14elif test -r /dynix; then
15  kernel_id=`strings /dynix | grep DYNIX`
16else
17  kernel_id=
18fi
19
20kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
21if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
22       != x$config_release; then
23  # The configuration release is a substring of the kernel release.
24  uname_release=$kernel_release
25elif test x$config_release != x; then
26  uname_release=$config_release
27elif test x$kernel_release != x; then
28  uname_release=$kernel_release
29else
30  uname_release=unknown
31fi
32
33kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
34if test -n "$kernel_version"; then
35  uname_version="$kernel_version"
36else
37  uname_version=unknown
38fi
39
40cat <<EOF
41/* This file is generated by $0.  DO NOT EDIT.
42
43   This is used only by the generic uname function for systems with no real
44   uname call.  If this data is not correct, it does not matter much.  */
45
46#define UNAME_SYSNAME "$uname_sysname"
47#define UNAME_RELEASE "$uname_release"
48#define UNAME_VERSION "$uname_version"
49#define UNAME_MACHINE "$uname_machine"
50EOF
51