#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/numlock,v 1.9 2004/02/15 20:01:09 azarah Exp $


depend() {
	need localmount
}

start() {
	ebegin "Enabling numlock on ttys"
	for tty in $(seq 1 "${RC_TTY_NUMBER}")
	do
		if [ -e /dev/.devfsd ] || \
		   [ -e /dev/.udev -a -d /dev/vc ]
		then
			setleds -D +num < /dev/vc/${tty} &>/dev/null
		else
			setleds -D +num < /dev/tty${tty} &>/dev/null
		fi
	done
	eend $? "Failed to enable numlock"
}

stop() {
	ebegin "Disabling numlock on ttys"
	for tty in $(seq 1 "${RC_TTY_NUMBER}")
	do
		if [ -e /dev/.devfsd ] || \
		   [ -e /dev/.udev -a -d /dev/vc ]
		then
			setleds -D -num < /dev/vc/${tty} &>/dev/null
		else
			setleds -D -num < /dev/tty${tty} &>/dev/null
		fi
	done
	eend $? "Failed to disable numlock"
}


# vim:ts=4
