File size: 1,048 Bytes
4eef109
 
 
70c3898
4eef109
70c3898
4eef109
 
 
d81280a
70c3898
 
 
 
 
 
 
 
 
 
 
 
 
d81280a
 
70c3898
d81280a
 
 
70c3898
4eef109
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
31
32
import os
import subprocess
import logging
import threading

# Set up logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s', handlers=[logging.StreamHandler()])

def setup_chrome_remote_desktop():
    logging.info("Starting Chrome Remote Desktop setup...")
    
    # Execute the command with the DISPLAY environment variable set
    command = [
        "bash", "-c", 
        'DISPLAY= /opt/google/chrome-remote-desktop/start-host --code="4/0AQlEd8zDHL-M_KotFr2ZooKjDqxs274Zl39q3Ht4J-OSBslWOukrjmKPfXixk99q4Tg9Xw" '
        '--redirect-url="https://remotedesktop.google.com/_/oauthredirect" '
        '--name=$(hostname) '
        '--pin=123456'
    ]
    
    # Run the command
    subprocess.run(command, shell=False)
    
    logging.info("Chrome Remote Desktop setup complete.")

# Run the Chrome Remote Desktop setup in a separate thread
crd_thread = threading.Thread(target=setup_chrome_remote_desktop)
crd_thread.start()

# Keep the container running
subprocess.run(["tail", "-f", "/dev/null"])