510.status-world-kernel revision 277520
1119610Sache#!/bin/sh
2119610Sache#
3157184Sache# $FreeBSD: stable/10/etc/periodic/daily/510.status-world-kernel 277520 2015-01-22 02:24:09Z gjb $
4119610Sache#
5119610Sache# Check that the running userland and kernel versions are in sync.
6119610Sache
7119610Sache# If there is a global system configuration file, suck it in.
8119610Sache#
9119610Sacheif [ -r /etc/defaults/periodic.conf ]
10119610Sachethen
11119610Sache    . /etc/defaults/periodic.conf
12119610Sache    source_periodic_confs
13119610Sachefi
14119610Sache
15119610Sachecase "$daily_status_world_kernel" in
16119610Sache    [Yy][Ee][Ss])
17119610Sache	rc=0
18119610Sache	_U=$(/usr/bin/uname -U 2>/dev/null)
19119610Sache	_K=$(/usr/bin/uname -K 2>/dev/null)
20119610Sache	[ -z "${_U}" -o -z "${_K}" ] && exit 0
21119610Sache	echo ""
22119610Sache	echo "Checking userland and kernel versions:"
23119610Sache	if [ "${_U}" != "${_K}" ]; then
24119610Sache	    echo "Userland and kernel are not in sync"
25119610Sache	    echo "Userland version: ${_U}"
26119610Sache	    echo "Kernel version: ${_K}"
27119610Sache	    rc=1
28119610Sache	else
29119610Sache	    echo "Userland and kernel are in sync."
30119610Sache	fi
31119610Sache	;;
32119610Sache
33119610Sache    *)  rc=0;;
34119610Sacheesac
35119610Sache
36119610Sacheexit $rc
37119610Sache