Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: remoting/host/linux/linux_me2me_host.py

Issue 1885483003: Copy Linux me2me script to output dir for GN builds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify code, and add GYP 'copies' rule Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # Virtual Me2Me implementation. This script runs and manages the processes 6 # Virtual Me2Me implementation. This script runs and manages the processes
7 # required for a Virtual Me2Me desktop, which are: X server, X desktop 7 # required for a Virtual Me2Me desktop, which are: X server, X desktop
8 # session, and Host process. 8 # session, and Host process.
9 # This script is intended to run continuously as a background daemon 9 # This script is intended to run continuously as a background daemon
10 # process, running under an ordinary (non-root) user account. 10 # process, running under an ordinary (non-root) user account.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 # defaults can be overridden in ~/.profile. 48 # defaults can be overridden in ~/.profile.
49 DEFAULT_SIZES = "1600x1200,3840x2560" 49 DEFAULT_SIZES = "1600x1200,3840x2560"
50 50
51 # If RANDR is not available, use a smaller default size. Only a single 51 # If RANDR is not available, use a smaller default size. Only a single
52 # resolution is supported in this case. 52 # resolution is supported in this case.
53 DEFAULT_SIZE_NO_RANDR = "1600x1200" 53 DEFAULT_SIZE_NO_RANDR = "1600x1200"
54 54
55 SCRIPT_PATH = os.path.abspath(sys.argv[0]) 55 SCRIPT_PATH = os.path.abspath(sys.argv[0])
56 SCRIPT_DIR = os.path.dirname(SCRIPT_PATH) 56 SCRIPT_DIR = os.path.dirname(SCRIPT_PATH)
57 57
58 IS_INSTALLED = (os.path.basename(sys.argv[0]) != 'linux_me2me_host.py') 58 if "me2me_host" in os.path.basename(sys.argv[0]):
59 59 # Script is being run from a Chromium checkout.
60 if IS_INSTALLED: 60 HOST_BINARY_NAME = "remoting_me2me_host"
61 else:
62 # Script is installed.
61 HOST_BINARY_NAME = "chrome-remote-desktop-host" 63 HOST_BINARY_NAME = "chrome-remote-desktop-host"
62 else:
63 HOST_BINARY_NAME = "remoting_me2me_host"
64 64
65 CHROME_REMOTING_GROUP_NAME = "chrome-remote-desktop" 65 CHROME_REMOTING_GROUP_NAME = "chrome-remote-desktop"
66 66
67 HOME_DIR = os.environ["HOME"] 67 HOME_DIR = os.environ["HOME"]
68 CONFIG_DIR = os.path.join(HOME_DIR, ".config/chrome-remote-desktop") 68 CONFIG_DIR = os.path.join(HOME_DIR, ".config/chrome-remote-desktop")
69 SESSION_FILE_PATH = os.path.join(HOME_DIR, ".chrome-remote-desktop-session") 69 SESSION_FILE_PATH = os.path.join(HOME_DIR, ".chrome-remote-desktop-session")
70 SYSTEM_SESSION_FILE_PATH = "/etc/chrome-remote-desktop-session" 70 SYSTEM_SESSION_FILE_PATH = "/etc/chrome-remote-desktop-session"
71 71
72 X_LOCK_FILE_TEMPLATE = "/tmp/.X%d-lock" 72 X_LOCK_FILE_TEMPLATE = "/tmp/.X%d-lock"
73 FIRST_X_DISPLAY_NUMBER = 20 73 FIRST_X_DISPLAY_NUMBER = 20
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 # choose it explicitly. 624 # choose it explicitly.
625 return [session_wrapper, "/usr/bin/gnome-session --session=ubuntu-2d"] 625 return [session_wrapper, "/usr/bin/gnome-session --session=ubuntu-2d"]
626 else: 626 else:
627 # Use the session wrapper by itself, and let the system choose a 627 # Use the session wrapper by itself, and let the system choose a
628 # session. 628 # session.
629 return [session_wrapper] 629 return [session_wrapper]
630 return None 630 return None
631 631
632 632
633 def locate_executable(exe_name): 633 def locate_executable(exe_name):
634 if IS_INSTALLED: 634 exe_path = os.path.join(SCRIPT_DIR, exe_name)
635 # If the script is running from its installed location, search the host 635 if os.path.exists(exe_path):
636 # binary only in the same directory. 636 return exe_path
637 paths_to_try = [ SCRIPT_DIR ]
638 else:
639 paths_to_try = map(lambda p: os.path.join(SCRIPT_DIR, p),
640 [".",
641 "../../../out/Debug",
642 "../../../out/Default",
643 "../../../out/Release"])
644 for path in paths_to_try:
645 exe_path = os.path.join(path, exe_name)
646 if os.path.exists(exe_path):
647 return exe_path
648 637
649 raise Exception("Could not locate executable '%s'" % exe_name) 638 raise Exception("Executable not found at '%s'" % exe_path)
650 639
651 640
652 class ParentProcessLogger(object): 641 class ParentProcessLogger(object):
653 """Redirects logs to the parent process, until the host is ready or quits. 642 """Redirects logs to the parent process, until the host is ready or quits.
654 643
655 This class creates a pipe to allow logging from the daemon process to be 644 This class creates a pipe to allow logging from the daemon process to be
656 copied to the parent process. The daemon process adds a log-handler that 645 copied to the parent process. The daemon process adds a log-handler that
657 directs logging output to the pipe. The parent process reads from this pipe 646 directs logging output to the pipe. The parent process reads from this pipe
658 until and writes the content to stderr. When the pipe is no longer needed 647 until and writes the content to stderr. When the pipe is no longer needed
659 (for example, the host signals successful launch or permanent failure), the 648 (for example, the host signals successful launch or permanent failure), the
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 else: 1388 else:
1400 logging.info("Host exited with status %s." % os.WEXITSTATUS(status)) 1389 logging.info("Host exited with status %s." % os.WEXITSTATUS(status))
1401 elif os.WIFSIGNALED(status): 1390 elif os.WIFSIGNALED(status):
1402 logging.info("Host terminated by signal %s." % os.WTERMSIG(status)) 1391 logging.info("Host terminated by signal %s." % os.WTERMSIG(status))
1403 1392
1404 1393
1405 if __name__ == "__main__": 1394 if __name__ == "__main__":
1406 logging.basicConfig(level=logging.DEBUG, 1395 logging.basicConfig(level=logging.DEBUG,
1407 format="%(asctime)s:%(levelname)s:%(message)s") 1396 format="%(asctime)s:%(levelname)s:%(message)s")
1408 sys.exit(main()) 1397 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698