#!/bin/sh
# pre install script for the Debian modutils package

set -e

# Check if we are upgrading while running a 2.0 kernel. If so abort
# immediately since we don't support those kernels anymore.
if [ "$1" = "upgrade" ] && dpkg --compare-versions "`uname -r`" lt 2.2.0 ; then
	cat <<EOF
ERROR: you are running a pre-2.2.0 kernel on this machine. Recent
versions of modutils no longer support those kernels.
EOF
	
	if [ ! -f /proc/modules ] ; then
		cat <<EOF
However, your kernel does not seem to use modules, so I will upgrade
anyway.
EOF
	else
		echo To prevent breaking this system the modutils upgrade will abort.
		exit 1
	fi
fi

exit 0

