summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'init.d/numlock')
-rwxr-xr-xinit.d/numlock34
1 files changed, 34 insertions, 0 deletions
diff --git a/init.d/numlock b/init.d/numlock
new file mode 100755
index 0000000..22654f0
--- /dev/null
+++ b/init.d/numlock
@@ -0,0 +1,34 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need localmount
+}
+
+start() {
+ ebegin "Enabling numlock on ttys"
+ local dev
+ [[ -d /dev/vc ]] \
+ && dev=/dev/vc/ \
+ || dev=/dev/tty
+ for tty in $(seq 1 "${RC_TTY_NUMBER}") ; do
+ setleds -D +num < ${dev}${tty} &> /dev/null
+ done
+ eend $? "Failed to enable numlock"
+}
+
+stop() {
+ ebegin "Disabling numlock on ttys"
+ local dev
+ [[ -d /dev/vc ]] \
+ && dev=/dev/vc/ \
+ || dev=/dev/tty
+ for tty in $(seq 1 "${RC_TTY_NUMBER}") ; do
+ setleds -D -num < ${dev}${tty} &> /dev/null
+ done
+ eend $? "Failed to disable numlock"
+}
+
+
+# vim:ts=4