startwm.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #!/usr/bin/env bash
  2. # This script is derived from https://github.com/neutrinolabs/xrdp/sesman/startwm.sh.
  3. #
  4. # This script is an example. You might need to edit this script
  5. # depending on your distro if it doesn't work for you.
  6. #
  7. # Uncomment the following line for debug:
  8. # exec xterm
  9. # Execution sequence for interactive login shell - pseudocode
  10. #
  11. # IF /etc/profile is readable THEN
  12. # execute ~/.bash_profile
  13. # END IF
  14. # IF ~/.bash_profile is readable THEN
  15. # execute ~/.bash_profile
  16. # ELSE
  17. # IF ~/.bash_login is readable THEN
  18. # execute ~/.bash_login
  19. # ELSE
  20. # IF ~/.profile is readable THEN
  21. # execute ~/.profile
  22. # END IF
  23. # END IF
  24. # END IF
  25. pre_start()
  26. {
  27. if [ -r /etc/profile ]; then
  28. . /etc/profile
  29. fi
  30. if [ -r ~/.bash_profile ]; then
  31. . ~/.bash_profile
  32. else
  33. if [ -r ~/.bash_login ]; then
  34. . ~/.bash_login
  35. else
  36. if [ -r ~/.profile ]; then
  37. . ~/.profile
  38. fi
  39. fi
  40. fi
  41. return 0
  42. }
  43. # When loging out from the interactive shell, the execution sequence is:
  44. #
  45. # IF ~/.bash_logout exists THEN
  46. # execute ~/.bash_logout
  47. # END IF
  48. post_start()
  49. {
  50. if [ -r ~/.bash_logout ]; then
  51. . ~/.bash_logout
  52. fi
  53. return 0
  54. }
  55. #start the window manager
  56. wm_start()
  57. {
  58. if [ -r /etc/default/locale ]; then
  59. . /etc/default/locale
  60. export LANG LANGUAGE
  61. fi
  62. # debian
  63. if [ -r /etc/X11/Xsession ]; then
  64. pre_start
  65. . /etc/X11/Xsession
  66. post_start
  67. exit 0
  68. fi
  69. # alpine
  70. # Don't use /etc/X11/xinit/Xsession - it doesn't work
  71. if [ -f /etc/alpine-release ]; then
  72. if [ -f /etc/X11/xinit/xinitrc ]; then
  73. pre_start
  74. /etc/X11/xinit/xinitrc
  75. post_start
  76. else
  77. echo "** xinit package isn't installed" >&2
  78. exit 1
  79. fi
  80. fi
  81. # el
  82. if [ -r /etc/X11/xinit/Xsession ]; then
  83. pre_start
  84. . /etc/X11/xinit/Xsession
  85. post_start
  86. exit 0
  87. fi
  88. # suse
  89. if [ -r /etc/X11/xdm/Xsession ]; then
  90. # since the following script run a user login shell,
  91. # do not execute the pseudo login shell scripts
  92. . /etc/X11/xdm/Xsession
  93. exit 0
  94. elif [ -r /usr/etc/X11/xdm/Xsession ]; then
  95. . /usr/etc/X11/xdm/Xsession
  96. exit 0
  97. fi
  98. pre_start
  99. xterm
  100. post_start
  101. }
  102. #. /etc/environment
  103. #export PATH=$PATH
  104. #export LANG=$LANG
  105. # change PATH to be what your environment needs usually what is in
  106. # /etc/environment
  107. #PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
  108. #export PATH=$PATH
  109. # for PATH and LANG from /etc/environment
  110. # pam will auto process the environment file if /etc/pam.d/xrdp-sesman
  111. # includes
  112. # auth required pam_env.so readenv=1
  113. wm_start
  114. exit 1