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