xref: /titanic_41/usr/src/lib/libresolv2/include/make_os_version.sh (revision fcf3ce441efd61da9bb2884968af01cb7c1452cc)
1#!/bin/sh
2
3# Copyright (c) 1999 by Sun Microsystems, Inc.
4# All rights reserved.
5#
6#pragma ident	"%Z%%M%	%I%	%E% SMI"
7
8UNAME_R=`/usr/bin/uname -r`
9
10OS_MAJOR=`echo $UNAME_R | /usr/bin/sed -e 's/^\([^.]*\).*/\1/'`
11OS_MINOR=`echo $UNAME_R | /usr/bin/sed -e 's/^[^.]*\.\([^.]*\).*/\1/'`
12OS_VERSION=`echo $UNAME_R | tr '.' '_'`
13
14cat <<EOF > new_os_version.h
15#ifndef OS_VERSION_H
16#define OS_VERSION_H
17
18#define SUNOS_$OS_VERSION
19#define OS_MAJOR $OS_MAJOR
20#define OS_MINOR $OS_MINOR
21
22#endif
23EOF
24
25if [ -f os_version.h ]; then
26	if /usr/bin/cmp -s new_os_version.h os_version.h; then
27		/usr/bin/rm -f new_os_version.h
28	else
29		/usr/bin/rm -f os_version.h
30		/usr/bin/mv new_os_version.h os_version.h
31	fi
32else
33	/usr/bin/mv new_os_version.h os_version.h
34fi
35