]> git.saurik.com Git - apple/xnu.git/blob - osfmk/conf/tools/kernel_newvers/kernel_newvers.csh
xnu-123.5.tar.gz
[apple/xnu.git] / osfmk / conf / tools / kernel_newvers / kernel_newvers.csh
1 #!/bin/sh -
2 #
3 # Mach Operating System
4 # Copyright (c) 1990 Carnegie-Mellon University
5 # Copyright (c) 1989 Carnegie-Mellon University
6 # All rights reserved. The CMU software License Agreement specifies
7 # the terms and conditions for use and redistribution.
8 #
9
10 #
11 # kernel_newvers.sh copyright major minor variant
12 #
13
14 major="$1"; minor="$2"; variant="$3"
15 version="${major}.${minor}"
16 if [ -n "$variant" ]; then version="${version}.${variant}"; fi
17
18 objdir="${OBJROOT}/${KERNEL_CONFIG}_${ARCH_CONFIG}"
19 time=`date`
20 who=`whoami`
21
22 if [ -z "${objdir}" ] || [ -z "${time}" ]; then exit 1; fi
23
24 CONFIG=`expr "${objdir}" : '.*/\([^/]*\)$'`
25 objdir=`expr "${objdir}" : '.*/\([^/]*/[^/]*/[^/]*\)$'`
26 (
27 /bin/echo "int version_major = ${major};" ;
28 /bin/echo "int version_minor = ${minor};" ;
29 /bin/echo "char version_variant[] = \"${variant}\";" ;
30 /bin/echo "char version[] = \"Darwin Kernel Version ${version}:\\n${time}; ${who}:${objdir}\\n\\n\";" ;
31 /bin/echo "char osrelease[] = \"${version}\";" ;
32 /bin/echo "char ostype[] = \"Darwin\";" ;
33 ) > kernel_vers.c
34
35 if [ -s vers.suffix -o ! -f vers.suffix ]; then
36 rm -f vers.suffix
37 echo ".${variant}.${CONFIG}" > vers.suffix
38 fi
39 exit 0