Skip to content
Snippets Groups Projects
Commit ba72261c authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Add x2go entries in REMOTE_CONNECTION property

 * Detect if x2goserver is installed
 * Detect the image's desktop environment
 * Update REMOTE_CONNECTION with the valid x2go entries
parent 83077870
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,19 @@ from image_creator.os_type.unix import Unix, sysprep ...@@ -22,6 +22,19 @@ from image_creator.os_type.unix import Unix, sysprep
import re import re
import time import time
X2GO_DESKTOPSESSIONS = {
'CINNAMON': 'cinnamon',
'KDE': 'startkde',
'GNOME': 'gnome-session',
'MATE': 'mate-session',
'XFCE': 'xfce4-session',
'LXDE': 'startlxde',
'TRINITY': 'starttrinity',
'UNITY': 'unity',
}
X2GO_EXECUTABLE = "x2goruncommand"
class Linux(Unix): class Linux(Unix):
"""OS class for Linux""" """OS class for Linux"""
...@@ -323,6 +336,24 @@ class Linux(Unix): ...@@ -323,6 +336,24 @@ class Linux(Unix):
self.meta['REMOTE_CONNECTION'] += " ".join(ssh) self.meta['REMOTE_CONNECTION'] += " ".join(ssh)
else: else:
self.meta['REMOTE_CONNECTION'] += "ssh:port=%d" % opts['port'] self.meta['REMOTE_CONNECTION'] += "ssh:port=%d" % opts['port']
# Check if x2go is installed
x2go_installed = False
desktops = set()
for path in ('/bin', '/usr/bin', '/usr/local/bin'):
if self.image.g.is_file("%s/%s" % (path, X2GO_EXECUTABLE)):
x2go_installed = True
for name, exe in X2GO_DESKTOPSESSIONS.items():
if self.image.g.is_file("%s/%s" % (path, exe)):
desktops.add(name)
if x2go_installed:
self.meta['REMOTE_CONNECTION'] += " "
if len(desktops) == 0:
self.meta['REMOTE_CONNECTION'] += "x2go"
else:
self.meta['REMOTE_CONNECTION'] += \
" ".join(["x2go:session=%s" % d for d in desktops])
else: else:
self.out.warn("OpenSSH Daemon is not configured to run on boot") self.out.warn("OpenSSH Daemon is not configured to run on boot")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment