aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChmouel Boudjnah <chmouel@mandriva.org>2000-04-05 16:54:10 +0000
committerChmouel Boudjnah <chmouel@mandriva.org>2000-04-05 16:54:10 +0000
commit3a6f7c2add6a9eb2ecefa8692351d3a83bfe67c2 (patch)
treedf5542afdb57cc37e2421e3fd6c6b0fcaa9327d0
parent7ca39f41581ff1911fd5c0831801c864a2cbf538 (diff)
downloadnumlock-3a6f7c2add6a9eb2ecefa8692351d3a83bfe67c2.tar
numlock-3a6f7c2add6a9eb2ecefa8692351d3a83bfe67c2.tar.gz
numlock-3a6f7c2add6a9eb2ecefa8692351d3a83bfe67c2.tar.bz2
numlock-3a6f7c2add6a9eb2ecefa8692351d3a83bfe67c2.tar.xz
numlock-3a6f7c2add6a9eb2ecefa8692351d3a83bfe67c2.zip
"Seethechangelog"
-rw-r--r--Makefile2
-rwxr-xr-xnumlock.init62
-rwxr-xr-xnumlock.sh1
3 files changed, 63 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 9b138e0..3b04d25 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ install: all
install -m755 enable_X11_numlock $(TOP)/usr/X11R6/bin
install -m755 enable_X11_numlock.1 $(TOP)/usr/X11R6/man/man1/
- install -m755 numlock $(TOP)/etc/rc.d/init.d/
+ install -m755 numlock.init $(TOP)/etc/rc.d/init.d/$(NAME)
install -m755 numlock.sh $(TOP)/etc/profile.d/
dis:
rm -rf $(NAME)-$(VERSION) ../$(NAME)-$(VERSION).tar*
diff --git a/numlock.init b/numlock.init
new file mode 100755
index 0000000..f196ff0
--- /dev/null
+++ b/numlock.init
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# Startup script for NumLock
+#
+# description: Locks NumLock key at init runlevel change
+# chkconfig: 345 85 15
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# The following file make bash to relock the numlock key when logging
+# since login unlock it.
+#SYSCONF_FILE=/var/lock/subsys/NumLock
+SYSCONF_FILE=/etc/sysconfig/NumLock
+
+# See how we were called.
+case "$1" in
+ start)
+ echo -n "Starting NumLock: "
+ echo_success
+ echo
+ touch $SYSCONF_FILE
+
+ for tty in /dev/tty[1-8]; do
+ setleds -D +num < $tty
+ done
+
+ ;;
+ stop)
+ echo -n "Disabling NumLocks on ttys: "
+ for tty in /dev/tty[1-8]; do
+ setleds -D -num < $tty
+ done
+ echo_success
+ echo
+ rm -f $SYSCONF_FILE
+ ;;
+ status)
+# status NumLock
+# echo "dead status as reported is normal since NumLock doesn't need to daemonize"
+ if [ -f $SYSCONF_FILE ]
+ then
+ echo "NumLock is enabled"
+ else
+ echo "NumLock is disabled"
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ reload)
+ echo -n "Reloading NumLock: "
+ $0 start
+ echo
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload|status}"
+ exit 1
+esac
+
+exit 0
diff --git a/numlock.sh b/numlock.sh
index 39781d1..b3a85fd 100755
--- a/numlock.sh
+++ b/numlock.sh
@@ -5,6 +5,5 @@
MY_TTY=`tty`
case $MY_TTY in
/dev/tty[0-9]*) [ -f /etc/sysconfig/NumLock ] && setleds -D +num < $MY_TTY;;
- /dev/pts/[0-9]*) [ "XX$DISPLAY" != "XX" ] && [ -x /usr/X11R6/bin/enable_X11_numlock ] && /usr/X11R6/bin/enable_X11_numlock
esac
unset MY_TTY \ No newline at end of file