Gentoo Archives: gentoo-user

From: n952162 <n952162@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] power button to shutdown for openrc?
Date: Sat, 16 Nov 2019 13:48:16
Message-Id: 7f62d5e9-a632-6bef-6aa8-b3416a5ad892@web.de
In Reply to: Re: [gentoo-user] power button to shutdown for openrc? by n952162
1 And, incidentally, I don't know if anybody's interested, but on my
2 system, I changed this:
3
4 if pidof x $PMS > /dev/null ||
5         ( test "$XUSER" != "" && pidof dcopserver > /dev/null &&
6 test -x /usr/bin/dcop && /usr/bin/dcop --user $XUSER kded kded
7 loadedModules | grep -q klaptopdaemon) ||
8         ( test "$XUSER" != "" && test -x /usr/bin/qdbus && test -r
9 /proc/$(pgrep -n kded4)/environ && su - $XUSER -c "eval $(echo -n
10 'export '; cat /proc/$(pgrep -n kded4)/environ |tr '\0' '\n'|grep
11 DBUS_SESSION_BUS_ADDRESS); qdbus org.kde.kded" | grep -q powerdevil)
12 ; then
13         # Get out as the power manager that is running will take
14 care of things.
15     exit
16 fi
17
18 to this:
19
20 if
21     pidof x $PMS > /dev/null ||
22     (
23         test "$XUSER" != "" &&
24         pidof dcopserver > /dev/null &&
25         test -x /usr/bin/dcop &&
26         /usr/bin/dcop --user $XUSER kded kded loadedModules | grep
27 -q klaptopdaemon
28     ) || (
29         test "$XUSER" != "" &&
30         test -x /usr/bin/qdbus &&
31         test -r /proc/$(pgrep -n kded4)/environ &&
32         su - $XUSER -c "eval $(
33             echo -n 'export ';
34             cat /proc/$(pgrep -n kded4)/environ | tr '\0' '\n' |
35 grep DBUS_SESSION_BUS_ADDRESS
36         ); qdbus org.kde.kded" | grep -q powerdevil
37     ); then
38         # Get out as the power manager that is running will take
39 care of things.
40         exit
41 fi
42
43 whereupon I was finally able to understand it.
44
45
46 On 11/16/19 10:34, n952162 wrote:
47 >
48 > On 11/13/19 09:55, Mick wrote:
49 >> On Wednesday, 13 November 2019 06:48:11 GMT n952162 wrote:
50 >>> I've reinstalled gentoo from the gentoo repository and now my power
51 >>> button doesn't do a shutdown anymore. What do I have to do to have it
52 >>> issue a shutdown? This is an openrc system.
53 >>>
54 >>> I have this, but it doesn't work:
55 >>>
56 >>> $ cat /etc/acpi/events/powerbtn
57 >>> event=button[ /]power.*
58 >>> action=/sbin/poweroff
59 >
60 > Okay, I'm a bit further.
61 >
62 > I have that file as well, but it doesn't do anything because another
63 > script in that same directory, "default", has this:
64 >
65 > event=.*
66 > action=/etc/acpi/default.sh %e
67 >
68 > //etc/acpi/default.sh /invokes /actions/powerbtn.sh/ which checks if
69 > the init program (process 1) is running with the name "openrc-init". 
70 > Otherwise, it's not interested.
71 >
72 > Unfortunately, I have:
73 >
74 > $ ps -p 1 -o comm=
75 > init
76 >
77 > Question: when does the init program run under the name openrc-init?