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