Re: [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]> |
On Thu, Jan 22, 2009 at 9:44 PM, Jigish Gohil <[email protected]> wrote: > Hello Community > > Please find attached the patch for the support for Nomad[1] in LDM. > Hi again Attached is the improved patch incorporating Gadi's suggestions. Could we now merge the patch as it does not affect any other part of the LDM functioning. Cheers -J ------------------------------------------------------------------------------ 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
(text/x-c, 3.2 KB)
=== 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 15:19:05 +0000
@@ -49,7 +49,12 @@
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 nomad is used, just export variables to file else run full Xsession
+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-27 14:57:09 +0000
@@ -266,15 +266,22 @@
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);
-
rc_files("xsession");
-}
+ if (ldm.nomad) {
+ command = g_strjoin(" ", "rdesktop", "-z", "-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);
+ }
+
+}
/*
* Load guest info
@@ -412,6 +419,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 +513,9 @@
putenv(server_env);
putenv(user_env);
+ /* store password for rdesktop */
+ 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 15:39:01 +0000
@@ -247,6 +247,11 @@
command = g_strjoin(" ", "ssh", "-S", ldm.control_socket, "-O", "exit", ldm.server, NULL);
+ if (ldm.nomad) {
+ ldm_wait(ldm.nomadpid); /* wait for rdesktop to close before closing socket */
+ ldm.nomadpid = 0;
+ }
+
loginfo(_("Shutting down ssh session: %s"), command);
pid = ldm_spawn(command, NULL, NULL, NULL);
ldm_wait(pid);