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

--- xrdp-0.9.20.orig/sesman/startwm.sh	2023-06-23 22:30:59.039814495 +0800
+++ xrdp-0.9.20/sesman/startwm.sh	2023-06-23 22:58:33.044630876 +0800
@@ -7,22 +7,65 @@
 # exec xterm
 
 
-# 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()
+{
+  #To customize system-wise session, edit this file.
+  #To customize user specific session, copy this file to $HOME and edit it.
+  #Please refer to DefaultWindowManager and UserWindowManager in /etc/xrdp/sesman.ini for more details.
+
+  #The default session is gnome (GNOME Session)
+  #sle means SLE-Classic Session
+  SESSION="plasma"
+
+  case $SESSION in
+    sle)
+      if [ -r /usr/bin/gnome-session ]; then
+        export XDG_SESSION_TYPE=x11
+        export GNOME_SHELL_SESSION_MODE=sle-classic
+        /usr/bin/gnome-session --session gnome-classic
+      elif [ -r /usr/bin/icewm-session ]; then
+        /usr/bin/icewm-session
+      fi
+      ;;
+    gnome)
+      if [ -r /usr/bin/gnome-session ]; then
+        export XDG_SESSION_TYPE=x11
+        /usr/bin/gnome-session
+      elif [ -r /usr/bin/icewm-session ]; then
+        /usr/bin/icewm-session
+      fi
+      ;;
+    plasma)
+      if [ -r /usr/bin/startplasma-x11 ]; then
+        export XDG_SESSION_TYPE=x11
+        /usr/bin/startplasma-x11
+      elif [ -r /usr/bin/icewm-session ]; then
+        /usr/bin/icewm-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
@@ -55,58 +98,58 @@
   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
-
-  # alpine
-  # Don't use /etc/X11/xinit/Xsession - it doesn't work
-  if [ -f /etc/alpine-release ]; then
-    if [ -f /etc/X11/xinit/xinitrc ]; then
-        pre_start
-        /etc/X11/xinit/xinitrc
-        post_start
-    else
-        echo "** xinit package isn't installed" >&2
-        exit 1
-    fi
-  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
-  elif [ -r /usr/etc/X11/xdm/Xsession ]; then
-    . /usr/etc/X11/xdm/Xsession
-    exit 0
-  fi
-
-  pre_start
-  xterm
-  post_start
-}
+# #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
+# 
+#   # alpine
+#   # Don't use /etc/X11/xinit/Xsession - it doesn't work
+#   if [ -f /etc/alpine-release ]; then
+#     if [ -f /etc/X11/xinit/xinitrc ]; then
+#         pre_start
+#         /etc/X11/xinit/xinitrc
+#         post_start
+#     else
+#         echo "** xinit package isn't installed" >&2
+#         exit 1
+#     fi
+#   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
+#   elif [ -r /usr/etc/X11/xdm/Xsession ]; then
+#     . /usr/etc/X11/xdm/Xsession
+#     exit 0
+#   fi
+# 
+#   pre_start
+#   xterm
+#   post_start
+# }
 
 #. /etc/environment
 #export PATH=$PATH
@@ -122,6 +165,7 @@
 # includes
 # auth       required     pam_env.so readenv=1
 
+pre_start
 wm_start
-
+post_start
 exit 1
openSUSE Build Service is sponsored by