[patch] LDM Nomad support with local CD/DVD/USB and sound

Jigish Gohil <[email protected]>
Newsgroups gmane.linux.terminal-server.devel
Message-ID <[email protected]>
Hello Community

Please find attached the patch for the support for Nomad[1] in LDM.

The patch adds support for login using rdesktop to Linux RDP server
(xrdp[2]). Shortcomings of xrdp server is that it does not support
local disks or sound redirection, we are using ssh socket tunnel
created by LDM to use local disks via LTSPFS. This patch solves both
the issues :)

Few of the big advantages of using xrdp server is more efficient
connection than NX and X over ssh, more secure than XDMCP. It also
provides session persistence so users can disconnect and resume where
they left off on reconnect. Nomad also supports compiz desktop
effects, a modified version of compiz is available on openSUSE 11.1 or
compiz-nomad branch here[3], this version takes advantage of the local
hardware to do all compositing and window management.

To use Nomad, xrdp is required to be installed and running on the
server and rdesktop inside the client image. Add the following
variable in lts.conf:

LDM_NOMAD = True

The above will create ssh socket normally to use with LTSPFS and then
launch rdesktop.

The patch is combined work of Akash, Jinita, Kshitij, Priyanka guided
by me and inputs from Gadi and Ogra.

Do let us know if we can improve it further or add any more features.

Ciao

Jigish
-- 
CyberOrg

[1] http://en.opensuse.org/Nomad
[2] http://xrdp.sourceforge.net
[3] http://gitweb.compiz-fusion.org/?p=compiz;a=shortlog;h=refs/heads/nomad-0.7.8

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword

_____________________________________________________________________
Ltsp-developer mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-developer
For additional LTSP help,   try #ltsp channel on irc.freenode.net
LDM-Nomad-support.diff (unknown/unknown, 5.4 KB)
=== modified file 'po/Makefile.in.in'
--- po/Makefile.in.in	2008-05-08 18:57:43 +0000
+++ po/Makefile.in.in	2009-01-22 10:23:13 +0000
@@ -54,16 +54,16 @@
 
 ALL_LINGUAS = @ALL_LINGUAS@
 
-PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; fi)
-
-USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep ^$$lang$$ $(srcdir)/LINGUAS`" -o -n "`echo $$ALINGUAS|grep ' ?$$lang ?'`"; then printf "$$lang "; fi; done; fi)
-
-USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
-
-POFILES=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
-
-DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(POFILES)
-EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS
+PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi)
+
+USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep ^$$lang$$ $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep ^$$lang$$`"; then printf "$$lang "; fi; done; fi)
+
+USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
+
+POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
+
+DISTFILES = Makefile.in.in POTFILES.in $(POFILES)
+EXTRA_DISTFILES = ChangeLog POTFILES.skip Makevars LINGUAS
 
 POTFILES = \
 # This comment gets stripped out
@@ -101,7 +101,6 @@
 install-data: install-data-@USE_NLS@
 install-data-no: all
 install-data-yes: all
-	$(mkdir_p) $(DESTDIR)$(itlocaledir)
 	linguas="$(USE_LINGUAS)"; \
 	for lang in $$linguas; do \
 	  dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \

=== modified file 'rc.d/X99-run-x-session'
--- rc.d/X99-run-x-session	2008-12-19 19:03:04 +0000
+++ rc.d/X99-run-x-session	2009-01-22 13:49:42 +0000
@@ -49,7 +49,11 @@
     MY_LOCALDEV="; /usr/sbin/ltspfsmounter all cleanup"
 fi
 
-ssh -Y -t -S $LDM_SOCKET -l $LDM_USERNAME $LDM_SERVER "$CLIENT_ENV $MY_LANG $MY_DISP $MY_SOUND $LDM_XSESSION $LDM_SESSION < /dev/null > /dev/null $MY_LOCALDEV"
+if boolean_is_true "$LDM_NOMAD"; then
+	ssh -S $LDM_SOCKET -l $LDM_USERNAME $LDM_SERVER "echo $MY_SOUND > ~/.ltspvars"
+else
+	ssh -Y -t -S $LDM_SOCKET -l $LDM_USERNAME $LDM_SERVER "$CLIENT_ENV $MY_LANG $MY_DISP $MY_SOUND $LDM_XSESSION $LDM_SESSION < /dev/null > /dev/null $MY_LOCALDEV"
+fi
 
 if [ "$SOUND_DAEMON" = "esd" ]; then
     kill $ESD_PID

=== modified file 'src/ldm.c'
--- src/ldm.c	2008-12-08 04:58:01 +0000
+++ src/ldm.c	2009-01-22 13:54:55 +0000
@@ -266,15 +266,26 @@
 void
 x_session(void)
 {
+    gchar *command;
     get_Xsession();
 
     setenv("LDM_SESSION", ldm.session, 1);
     setenv("LDM_XSESSION", ldm.xsession, 1);
     if(ldm.lang)
         setenv("LDM_LANGUAGE", ldm.lang, 1);
+    if (!ldm.nomad) {
+        rc_files("xsession");
+        }
+    else
+        {
+        rc_files("xsession");
+        command = g_strjoin(" ", "rdesktop", "-f", "-u", ldm.username, "-p", ldm.nomadpassword, " ", ldm.server, NULL);
+        ldm.nomadpid = ldm_spawn(command, NULL, NULL, NULL);
+	g_free(command);
+	g_free(ldm.nomadpassword);
+     }
 
-    rc_files("xsession");
-}
+} 
 
 /*
  * Load guest info
@@ -412,6 +423,7 @@
     ldm.localdev = ldm_getenv_bool("LOCALDEV");
     ldm.override_port = g_strdup(getenv("SSH_OVERRIDE_PORT"));
     ldm.directx = ldm_getenv_bool("LDM_DIRECTX");
+    ldm.nomad = ldm_getenv_bool("LDM_NOMAD");
     ldm.autologin = ldm_getenv_bool("LDM_AUTOLOGIN");
     ldm.lang = g_strdup(getenv("LDM_LANGUAGE"));
     ldm.session = g_strdup(getenv("LDM_SESSION"));
@@ -505,6 +517,8 @@
     putenv(server_env);
     putenv(user_env);
 
+    ldm.nomadpassword = g_strdup(ldm.password);
+
     ssh_session();                          /* Log in via ssh */
 
     if (ldm.greeterpid) {

=== modified file 'src/ldm.h'
--- src/ldm.h	2008-12-09 07:30:43 +0000
+++ src/ldm.h	2009-01-22 10:22:40 +0000
@@ -9,6 +9,7 @@
     gchar    *authfile;
     gchar    *username;
     gchar    *password;
+    gchar    *nomadpassword;
     gchar    *lang;
     gchar    *session;
     gchar    *xsession;
@@ -22,12 +23,14 @@
     gboolean sound;
     gboolean localdev;
     gboolean directx;
+    gboolean nomad;
     gint     sshfd;
     gint     sshslavefd;
     GIOChannel *greeterr;
     GIOChannel *greeterw;
     GPid     pid;
     GPid     sshpid;
+    GPid     nomadpid;
     GPid     xsessionpid;
     GPid     greeterpid;
 };

=== modified file 'src/sshutils.c'
--- src/sshutils.c	2008-12-09 07:30:43 +0000
+++ src/sshutils.c	2009-01-22 10:22:40 +0000
@@ -248,11 +248,13 @@
         command = g_strjoin(" ", "ssh", "-S", ldm.control_socket, "-O", "exit", ldm.server, NULL);
 
         loginfo(_("Shutting down ssh session: %s"), command);
+        ldm_wait(ldm.nomadpid);
         pid = ldm_spawn(command, NULL, NULL, NULL);
         ldm_wait(pid);
         read(ldm.sshfd, buf, sizeof buf);       /* clear any exit message so ssh can exit cleanly */
         ldm_wait(ldm.sshpid);
         ldm.sshpid = 0;
+        ldm.nomadpid = 0;
         g_free(command);
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.