--- tlmisc/xstartup/Makefile (revision 31558) +++ tlmisc/xstartup/Makefile (revision 31567) @@ -18,8 +18,8 @@ mkdir -p $(PREFIX)/share/xstartup # Programs install xstartup.default $(PREFIX)/etc/ - install tl-run-xstartup.d $(PREFIX)/libexec/ - install tl-run-xlogout.d $(PREFIX)/libexec/ + install -m 644 tl-run-xstartup.d $(PREFIX)/libexec/ + install -m 644 tl-run-xlogout.d $(PREFIX)/libexec/ $(OINSTALL) tl-xstartup-desc $(PREFIX)/libexec/ $(OINSTALL) tl-run-xstartup-feedback $(PREFIX)/libexec/ # Glade files --- tlmisc/xstartup/xstartup.default (revision 31558) +++ tlmisc/xstartup/xstartup.default (revision 31567) @@ -1,5 +1,12 @@ #!/bin/bash +# -*- mode: shell-script; coding: utf-8 -*- +# +# Copyright 2002-2016 Cendio AB. +# For more information, see http://www.cendio.com +# Ignore SIGHUP, in case Xserver/xinit terminates +trap "" SIGHUP + # Run all scripts in xstartup.d source "${TLPREFIX}/libexec/tl-run-xstartup.d" --- autotests/tests/agentbase.py (revision 31558) +++ autotests/tests/agentbase.py (revision 31567) @@ -333,7 +333,7 @@ pass class XStartupBase(LocalServerBase, base.ScriptRunMixin): - def setUp(self, filename, executable): + def setUp(self, filename): LocalServerBase.setUp(self) try: base.ScriptRunMixin.setUp(self) @@ -387,12 +387,11 @@ if ret: raise Exception("Unable to write to %s." % filename) - if executable: - dir = self.machine.create('disttest.fileio.Directory') - ret = dir.chmod(filename, 0555) - del dir - if ret: - raise Exception("Unable to make file executable") + dir = self.machine.create('disttest.fileio.Directory') + ret = dir.chmod(filename, 0555) + del dir + if ret: + raise Exception("Unable to make file executable") except: try: --- autotests/tests/agent.py (revision 31558) +++ autotests/tests/agent.py (revision 31567) @@ -339,7 +339,7 @@ class UserXStartup(agentbase.XStartupBase): def setUp(self): - agentbase.XStartupBase.setUp(self, '~/.thinlinc/xstartup', False) + agentbase.XStartupBase.setUp(self, '~/.thinlinc/xstartup') def runTest(self): """Test that the user's xstartup file is executed.""" @@ -356,7 +356,7 @@ class GlobalXStartup(agentbase.XStartupBase): def setUp(self): - agentbase.XStartupBase.setUp(self, thintest.THINLINC_PATH + '/etc/xsession', True) + agentbase.XStartupBase.setUp(self, thintest.THINLINC_PATH + '/etc/xsession') def runTest(self): """Test that the global xsession script is executed.""" @@ -373,7 +373,7 @@ class DefaultXStartup(agentbase.XStartupBase): def setUp(self): - agentbase.XStartupBase.setUp(self, thintest.THINLINC_PATH + '/etc/xstartup.default', False) + agentbase.XStartupBase.setUp(self, thintest.THINLINC_PATH + '/etc/xstartup.default') def runTest(self): """Test that the default xstartup script is executed.""" --- autotests/installedtree/test_installedfiles.py (revision 31558) +++ autotests/installedtree/test_installedfiles.py (revision 31567) @@ -121,7 +121,9 @@ "/opt/thinlinc/libexec/tl-mount-personal"]: mode = 04755 if f in ["/opt/thinlinc/libexec/functions", - "/opt/thinlinc/libexec/syscheck.sh"]: + "/opt/thinlinc/libexec/syscheck.sh", + "/opt/thinlinc/libexec/tl-run-xstartup.d", + "/opt/thinlinc/libexec/tl-run-xlogout.d"]: mode = 0644 self.assertEqual(stat.S_IMODE(buf), mode, "%s does not have mode %o" % (f, mode)) @@ -549,13 +551,15 @@ def test_configfiles(self): """Configuration files should not be executable""" + exceptions = ["/opt/thinlinc/etc/xsession", + "/opt/thinlinc/etc/xstartup.default"] files = glob.glob("/opt/thinlinc/etc/*") + glob.glob("/opt/thinlinc/etc/conf.d/*") for f in files: if os.path.isdir(f): continue buf = os.stat(f)[stat.ST_MODE] self.assert_(stat.S_ISREG(buf), "%s is not regular" % f) - if f.startswith("/opt/thinlinc/etc/xstartup.d"): + if f in exceptions: continue elif f in self.secret_600: continue --- doc/external/commands.xml (revision 31558) +++ doc/external/commands.xml (revision 31567) @@ -555,9 +555,9 @@ - This command is run by the session startup file - (~/.thinlinc/xstartup) in its default form to - execute all start scripts in the directory + This command is run by the default session startup file + (/opt/thinlinc/etc/xstartup.default) to execute + all start scripts in the directory /opt/thinlinc/etc/xstartup.d/. Files with the suffix .sh will be sourced. All other files will be executed. --- doc/external/configuration.xml (revision 31558) +++ doc/external/configuration.xml (revision 31567) @@ -427,11 +427,9 @@ - Since xstartup is run through - /bin/bash --login, files in - /etc/profile.d will be sourced and may - override values in - [/vsmagent/default_environment] + xstartup is executed via a login shell, + which may modify the environment and override values in + [/vsmagent/default_environment]. --- vsm/noshell (revision 31558) +++ vsm/noshell (revision 31567) @@ -44,4 +44,16 @@ ;; esac +# xstartup is invoked from inside a session, so this must be set +[ -n "${TLPREFIX}" ] || end + +case "$2" in + ~/.thinlinc/xstartup) + exec ~/.thinlinc/xstartup + ;; + "${TLPREFIX}/etc/xstartup.default") + exec "${TLPREFIX}/etc/xstartup.default" + ;; +esac + end --- vsm/modules/thinlinc/vsm/sessionstart.py (revision 31558) +++ vsm/modules/thinlinc/vsm/sessionstart.py (revision 31567) @@ -179,7 +179,7 @@ vncpasswdfile = locale_encode(self.vncpasswdfile) tlsession = os.path.join(self.session_env['TLPREFIX'], "libexec", "tl-session") - args = [tlsession, "/bin/bash", "--login", xstartupfile, + args = [tlsession, xstartupfile, "--", xvnc_binary, ":%d" % disp, "-depth", "24", "-geometry", "%dx%d" % fbsize, --- vsm/xsession (revision 31558) +++ vsm/xsession (revision 31567) @@ -1,12 +1,9 @@ #!/bin/bash # -*- mode: shell-script; coding: utf-8 -*- # -# Copyright 2002-2014 Cendio AB. +# Copyright 2002-2016 Cendio AB. # For more information, see http://www.cendio.com -# Ignore SIGHUP, in case Xserver/xinit terminates -trap "" SIGHUP - # Set language on Debian based systems if [ -r /etc/default/locale ]; then source /etc/default/locale @@ -17,9 +14,10 @@ # Log system/distribution information source ${TLPREFIX}/libexec/log_sysinfo.sh -# Source xstartup script +# Custom xstartup script has priority if [ -f ~/.thinlinc/xstartup ] ; then - source ~/.thinlinc/xstartup -else - source "${TLPREFIX}/etc/xstartup.default" + exec -l $SHELL -c ~/.thinlinc/xstartup fi + +# Default xstartup script +exec -l $SHELL -c "${TLPREFIX}/etc/xstartup.default" --- vsm/Makefile (revision 31558) +++ vsm/Makefile (revision 31567) @@ -224,7 +224,7 @@ $(INSTALL) -m 755 init.d/vsmagent $(ROOTDIR)/etc/init.d/ $(INSTALL) -m 644 logrotate.d/thinlinc-vsm-agent $(ROOTDIR)/etc/logrotate.d/ $(INSTALL) -m 644 vsmagent.hconf $(PREFIX)/etc/conf.d/ - $(INSTALL) -m 644 xsession $(PREFIX)/etc/ + $(INSTALL) -m 755 xsession $(PREFIX)/etc/ $(INSTALL) -s encrypt-vnc-pw $(PREFIX)/sbin/ $(INSTALL) -s tl-session tl-xinit $(PREFIX)/libexec/ $(OINSTALL) tl-set-sso-helper $(PREFIX)/libexec/