Revision 25561,
919 bytes
checked in by jdreed, 13 years ago
(diff) |
Move lightdm-launch-kiosk to correct location in source tree
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | #!/usr/bin/python -Wall |
---|
2 | |
---|
3 | import os |
---|
4 | |
---|
5 | LAUNCH_COMMAND = "/usr/lib/debathena-kiosk/launch-kiosk" |
---|
6 | |
---|
7 | |
---|
8 | def main(): |
---|
9 | pid = os.fork() |
---|
10 | if pid == 0: |
---|
11 | # Start a new session. |
---|
12 | os.setsid(); |
---|
13 | # Fork another child to launch the command. |
---|
14 | pid = os.fork() |
---|
15 | if pid == 0: |
---|
16 | # Here in the second child, exec the command. |
---|
17 | try: |
---|
18 | os.execlp("sudo", "sudo", "-n", LAUNCH_COMMAND) |
---|
19 | except OSError, e: |
---|
20 | print "error: Could not run %s as root: %s" % (LAUNCH_COMMAND, e.strerror) |
---|
21 | os._exit(255) |
---|
22 | else: |
---|
23 | # The first child exits immediately. |
---|
24 | os._exit(0) |
---|
25 | else: |
---|
26 | # Here in the parent: wait for the first child to exit. |
---|
27 | (pid, status) = os.waitpid(pid, 0) |
---|
28 | if status != 0: |
---|
29 | print "error launching command, status %d" % status |
---|
30 | |
---|
31 | if __name__ == '__main__': |
---|
32 | main() |
---|
Note: See
TracBrowser
for help on using the repository browser.