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