[26424] in Source-Commits
/svn/athena r25561 - trunk/debathena/debathena/kiosk
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Mon Jun 4 12:15:43 2012
Date: Mon, 4 Jun 2012 12:15:43 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201206041615.q54GFhcZ018440@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jdreed
Date: 2012-06-04 12:15:42 -0400 (Mon, 04 Jun 2012)
New Revision: 25561
Added:
trunk/debathena/debathena/kiosk/lightdm-launch-kiosk
Log:
Move lightdm-launch-kiosk to correct location in source tree
Copied: trunk/debathena/debathena/kiosk/lightdm-launch-kiosk (from rev 25559, trunk/debathena/debathena/kiosk/debian/lightdm-launch-kiosk)
===================================================================
--- trunk/debathena/debathena/kiosk/lightdm-launch-kiosk (rev 0)
+++ trunk/debathena/debathena/kiosk/lightdm-launch-kiosk 2012-06-04 16:15:42 UTC (rev 25561)
@@ -0,0 +1,32 @@
+#!/usr/bin/python -Wall
+
+import os
+
+LAUNCH_COMMAND = "/usr/lib/debathena-kiosk/launch-kiosk"
+
+
+def main():
+ pid = os.fork()
+ if pid == 0:
+ # Start a new session.
+ os.setsid();
+ # Fork another child to launch the command.
+ pid = os.fork()
+ if pid == 0:
+ # Here in the second child, exec the command.
+ try:
+ os.execlp("sudo", "sudo", "-n", LAUNCH_COMMAND)
+ except OSError, e:
+ print "error: Could not run %s as root: %s" % (LAUNCH_COMMAND, e.strerror)
+ os._exit(255)
+ else:
+ # The first child exits immediately.
+ os._exit(0)
+ else:
+ # Here in the parent: wait for the first child to exit.
+ (pid, status) = os.waitpid(pid, 0)
+ if status != 0:
+ print "error launching command, status %d" % status
+
+if __name__ == '__main__':
+ main()