File: consoleuser-logind.patch

package info (click to toggle)
killer 0.90-15
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 764 kB
  • sloc: perl: 8,785; makefile: 35; sh: 1
file content (30 lines) | stat: -rw-r--r-- 909 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Description: Use loginctl to find consoleuser if who and consolekit fail.
Author: Petter Reinholdtsen <pere@debian.org>
Last-Update: 2014-09-28

--- killer-0.90.orig/killer
+++ killer-0.90/killer
@@ -931,6 +931,23 @@ sub initialize {
             close(W);
         }
     }
+
+    # FIXME figure out how to handle several console users for multiseat machine
+    my $loginctlcmd = "/bin/loginctl";
+    if ( ! $consoleuser && -x $loginctlcmd) {
+        print "found no console user using who or consolekit, trying logind\n" if $debug;
+        if (open ( W, "$loginctlcmd|")) {
+            while ( <W> ) {
+                chomp;
+                if (/^\s*(\d+)\s+(\d+)\s+(\w+)\s*seat\d+/) {
+                    $consoleuser = $3;
+                    print "Found local logind user $consoleuser\n" if $debug;
+                }
+            }
+            close(W);
+        }
+    }
+
     return;
 }