xref: /freebsd/usr.sbin/periodic/etc/daily/510.status-world-kernel (revision 81ea85a8845662ca329a954eeeb3e6d4124282a2)
1*81ea85a8SBrad Davis#!/bin/sh
2*81ea85a8SBrad Davis#
3*81ea85a8SBrad Davis# $FreeBSD$
4*81ea85a8SBrad Davis#
5*81ea85a8SBrad Davis# Check that the running userland and kernel versions are in sync.
6*81ea85a8SBrad Davis
7*81ea85a8SBrad Davis# If there is a global system configuration file, suck it in.
8*81ea85a8SBrad Davis#
9*81ea85a8SBrad Davisif [ -r /etc/defaults/periodic.conf ]
10*81ea85a8SBrad Davisthen
11*81ea85a8SBrad Davis    . /etc/defaults/periodic.conf
12*81ea85a8SBrad Davis    source_periodic_confs
13*81ea85a8SBrad Davisfi
14*81ea85a8SBrad Davis
15*81ea85a8SBrad Daviscase "$daily_status_world_kernel" in
16*81ea85a8SBrad Davis    [Yy][Ee][Ss])
17*81ea85a8SBrad Davis	rc=0
18*81ea85a8SBrad Davis	_U=$(/usr/bin/uname -U 2>/dev/null)
19*81ea85a8SBrad Davis	_K=$(/usr/bin/uname -K 2>/dev/null)
20*81ea85a8SBrad Davis	[ -z "${_U}" -o -z "${_K}" ] && exit 0
21*81ea85a8SBrad Davis	echo ""
22*81ea85a8SBrad Davis	echo "Checking userland and kernel versions:"
23*81ea85a8SBrad Davis	if [ "${_U}" != "${_K}" ]; then
24*81ea85a8SBrad Davis	    echo "Userland and kernel are not in sync"
25*81ea85a8SBrad Davis	    echo "Userland version: ${_U}"
26*81ea85a8SBrad Davis	    echo "Kernel version: ${_K}"
27*81ea85a8SBrad Davis	    rc=1
28*81ea85a8SBrad Davis	else
29*81ea85a8SBrad Davis	    echo "Userland and kernel are in sync."
30*81ea85a8SBrad Davis	fi
31*81ea85a8SBrad Davis	;;
32*81ea85a8SBrad Davis
33*81ea85a8SBrad Davis    *)  rc=0;;
34*81ea85a8SBrad Davisesac
35*81ea85a8SBrad Davis
36*81ea85a8SBrad Davisexit $rc
37