2013-12-21 14:51:11 -06:00
|
|
|
#!@SBINDIR@/openrc-run
|
2009-05-01 15:11:40 +01:00
|
|
|
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
2011-06-29 19:46:31 -04:00
|
|
|
# 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."
|
|
|
|
|
2009-02-13 12:24:32 +00:00
|
|
|
ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
2007-11-23 22:23:20 +00:00
|
|
|
|
2008-01-11 12:13:46 +00:00
|
|
|
depend()
|
|
|
|
{
|
2007-04-05 11:18:42 +00:00
|
|
|
need localmount
|
2012-07-02 22:04:22 -05:00
|
|
|
keyword -openvz -prefix -vserver -lxc
|
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/
|
|
|
|
|
2009-04-27 07:51:18 +00:00
|
|
|
while [ $i -le $ttyn ]; do
|
|
|
|
setleds -D "$1"num < $dev$i || retval=1
|
2011-11-10 21:46:08 -05:00
|
|
|
: $(( i += 1 ))
|
2007-04-05 11:18:42 +00:00
|
|
|
done
|
|
|
|
|
2009-04-27 07:51:18 +00:00
|
|
|
return $retval
|
2007-04-05 11:18:42 +00:00
|
|
|
}
|
|
|
|
|
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"
|
|
|
|
}
|