2008-03-02 21:14:01 +00:00
|
|
|
#!@PREFIX@/sbin/runscript
|
2008-01-11 15:31:10 +00:00
|
|
|
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
|
|
|
# All rights reserved. Released under the 2-clause BSD license.
|
2007-11-14 15:22:04 +00:00
|
|
|
|
2007-07-10 19:09:41 +00:00
|
|
|
description="Turns numlock on for the consoles."
|
|
|
|
|
2007-11-23 22:23:20 +00:00
|
|
|
ttyn=${rc_tty_number:-${RC_TTY_NUMBER}:-12}
|
|
|
|
|
2008-01-11 12:13:46 +00:00
|
|
|
depend()
|
|
|
|
{
|
2007-04-05 11:18:42 +00:00
|
|
|
need localmount
|
2008-03-03 17:19:56 +00:00
|
|
|
keyword noopenvz noprefix novserver
|
2007-04-05 11:18:42 +00:00
|
|
|
}
|
|
|
|
|
2008-01-11 12:13:46 +00:00
|
|
|
_setleds()
|
|
|
|
{
|
2007-04-05 11:18:42 +00:00
|
|
|
[ -z "$1" ] && return 1
|
|
|
|
|
|
|
|
local dev=/dev/tty t= i=1 retval=0
|
|
|
|
[ -d /dev/vc ] && dev=/dev/vc/
|
|
|
|
|
2007-11-28 15:45:03 +00:00
|
|
|
while [ ${i} -le ${ttyn} ]; do
|
2007-04-05 11:18:42 +00:00
|
|
|
setleds -D "$1"num < ${dev}${i} || retval=1
|
|
|
|
i=$((${i} + 1))
|
|
|
|
done
|
|
|
|
|
|
|
|
return ${retval}
|
|
|
|
}
|
|
|
|
|
2008-01-11 12:13:46 +00:00
|
|
|
start()
|
|
|
|
{
|
2007-04-05 11:18:42 +00:00
|
|
|
ebegin "Enabling numlock on ttys"
|
|
|
|
_setleds +
|
|
|
|
eend $? "Failed to enable numlock"
|
|
|
|
}
|
|
|
|
|
2008-01-11 12:13:46 +00:00
|
|
|
stop()
|
|
|
|
{
|
2007-04-05 11:18:42 +00:00
|
|
|
ebegin "Disabling numlock on ttys"
|
|
|
|
_setleds -
|
|
|
|
eend $? "Failed to disable numlock"
|
|
|
|
}
|