File xrdp-bsc965647-allow-admin-choose-desktop.patch of Package xrdp

diff --git a/sesman/startwm.sh b/sesman/startwm.sh
index 452917a..ace62a0 100755
--- a/sesman/startwm.sh
+++ b/sesman/startwm.sh
@@ -1,33 +1,62 @@
 #!/bin/sh
 
-# Execution sequence for interactive login shell - pseudocode
-#
-# IF /etc/profile is readable THEN
-#     execute ~/.bash_profile
-# END IF
-# IF ~/.bash_profile is readable THEN
-#     execute ~/.bash_profile
-# ELSE
-#     IF ~/.bash_login is readable THEN
-#         execute ~/.bash_login
-#     ELSE
-#         IF ~/.profile is readable THEN
-#             execute ~/.profile
-#         END IF
-#     END IF
-# END IF
+#start the window manager
+wm_start()
+{
+  #Customize your preferred session mode here
+  SESSION="sle"
+
+  case $SESSION in
+    sle)
+      if [ -r /usr/bin/gnome-session ]; then
+        export GNOME_SHELL_SESSION_MODE=classic
+        export SLE_CLASSIC_MODE=1
+        /usr/bin/gnome-session --session gnome-classic
+      fi
+      ;;
+    gnome)
+      if [ -r /usr/bin/gnome-session ]; then
+        /usr/bin/gnome-session
+      fi
+      ;;
+    icewm)
+      if [ -r /usr/bin/icewm-session ]; then
+        /usr/bin/icewm-session
+      fi
+      ;;
+  esac
+}
+
+#Execution sequence for interactive login shell
+#Following pseudo code explains the sequence of execution of these files.
+#execute /etc/profile
+#IF ~/.bash_profile exists THEN
+#    execute ~/.bash_profile
+#ELSE
+#    IF ~/.bash_login exist THEN
+#        execute ~/.bash_login
+#    ELSE
+#        IF ~/.profile exist THEN
+#            execute ~/.profile
+#        END IF
+#    END IF
+#END IF
 pre_start()
 {
-  if [ -r /etc/profile ]; then
+  if [ -f /etc/profile ]
+  then
     . /etc/profile
   fi
-  if [ -r ~/.bash_profile ]; then
+  if [ -f ~/.bash_profile ]
+  then
     . ~/.bash_profile
   else
-    if [ -r ~/.bash_login ]; then
+    if [ -f ~/.bash_login ]
+    then
       . ~/.bash_login
     else
-      if [ -r ~/.profile ]; then
+      if [ -f ~/.profile ]
+      then
         . ~/.profile
       fi
     fi
@@ -35,56 +64,20 @@ pre_start()
   return 0
 }
 
-# When loging out from the interactive shell, the execution sequence is:
-#
-# IF ~/.bash_logout exists THEN
-#     execute ~/.bash_logout
-# END IF
+#When you logout of the interactive shell, following is the
+#sequence of execution:
+#IF ~/.bash_logout exists THEN
+#    execute ~/.bash_logout
+#END IF
 post_start()
 {
-  if [ -r ~/.bash_logout ]; then
+  if [ -f ~/.bash_logout ]
+  then
     . ~/.bash_logout
   fi
   return 0
 }
 
-#start the window manager
-wm_start()
-{
-  if [ -r /etc/default/locale ]; then
-    . /etc/default/locale
-    export LANG LANGUAGE
-  fi
-
-  # debian
-  if [ -r /etc/X11/Xsession ]; then
-    pre_start
-    . /etc/X11/Xsession
-    post_start
-    exit 0
-  fi
-
-  # el
-  if [ -r /etc/X11/xinit/Xsession ]; then
-    pre_start
-    . /etc/X11/xinit/Xsession
-    post_start
-    exit 0
-  fi
-
-  # suse
-  if [ -r /etc/X11/xdm/Xsession ]; then
-    # since the following script run a user login shell,
-    # do not execute the pseudo login shell scripts
-    . /etc/X11/xdm/Xsession
-    exit 0
-  fi
-
-  pre_start
-  xterm
-  post_start
-}
-
 #. /etc/environment
 #export PATH=$PATH
 #export LANG=$LANG
@@ -99,6 +92,8 @@ wm_start()
 # includes
 # auth       required     pam_env.so readenv=1
 
+pre_start
 wm_start
+post_start
 
 exit 1
openSUSE Build Service is sponsored by