Gentoo Archives: gentoo-user

From: covici@××××××××××.com
To: gentoo-user@l.g.o
Subject: [gentoo-user] numlock script and systemd
Date: Mon, 09 Jun 2014 02:39:54
Message-Id: 16364.1402281583@ccs.covici.com
1 Hi. I would like to use my /etc/init.d/numlock script with systemd, but
2 systemctl start just says warning numlock is already starting. I
3 thought that if a service was not there it would use something in
4 /etc/init.d and create one, so what am I doing wrong?
5
6 Here is the script
7 ----------cut here ----------
8 #!/sbin/runscript
9 # Copyright (c) 2007-2009 Roy Marples <roy@×××××××.name>
10 # Released under the 2-clause BSD license.
11
12 description="Turns numlock on for the consoles."
13
14 ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
15
16 depend()
17 {
18 need localmount
19 keyword -openvz -prefix -vserver -lxc
20 }
21
22 _setleds()
23 {
24 [ -z "$1" ] && return 1
25
26 local dev=/dev/tty t= i=1 retval=0
27 [ -d /dev/vc ] && dev=/dev/vc/
28
29 while [ $i -le $ttyn ]; do
30 setleds -D "$1"num < $dev$i || retval=1
31 : $(( i += 1 ))
32 done
33
34 return $retval
35 }
36
37 start()
38 {
39 ebegin "Enabling numlock on ttys"
40 _setleds +
41 eend $? "Failed to enable numlock"
42 }
43
44 stop()
45 {
46 ebegin "Disabling numlock on ttys"
47 _setleds -
48 eend $? "Failed to disable numlock"
49 }
50 ------------- cut here ----------
51
52 It does work under openrc.
53
54 Thanks in advance for any suggestions.
55
56 --
57 Your life is like a penny. You're going to lose it. The question is:
58 How do
59 you spend it?
60
61 John Covici
62 covici@××××××××××.com

Replies

Subject Author
Re: [gentoo-user] numlock script and systemd "Canek Peláez Valdés" <caneko@×××××.com>