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