summaryrefslogtreecommitdiffstats
path: root/remote/modules/xorg/data/etc/X11/Xsession
blob: a9b3d43b33c5e66fe7972c92fbbb502a94d8245c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash

#Workaround to start Xsession. The original Xsession script includes error handling functionality and sources other scrips from the Xsession.d/ directory.

#start selected session
   case "$1" in
      failsafe)
        # Failsafe session was requested.
          if [ -e /usr/bin/xterm ]; then
            if [ -x /usr/bin/xterm ]; then
              exec xterm -geometry +1+1
            else
              # fatal error
              errormsg "unable to launch failsafe X session ---" \
                       "x-terminal-emulator not executable; aborting."
            fi
          else
            # fatal error
            errormsg "unable to launch failsafe X session ---" \
                     "x-terminal-emulator not found; aborting."
          fi
        ;;
      *)
        # Specific program was requested.
        STARTUP_FULL_PATH=$(/opt/openslx/usr/bin/which "${1%% *}" || true)
        if [ -n "$STARTUP_FULL_PATH" ] && [ -e "$STARTUP_FULL_PATH" ]; then
          if [ -x "$STARTUP_FULL_PATH" ]; then
            exec $1
          else
            message "unable to launch \"$1\" X session ---" \
                    "\"$1\" not executable; falling back to default session."
          fi
        else
          message "unable to launch \"$1\" X session ---" \
                  "\"$1\" not found; falling back to default session."
        fi
        ;;
    esac