File: ldm-script.in

package info (click to toggle)
ldm 2:2.18.06-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,236 kB
  • sloc: ansic: 4,599; sh: 266; python: 260; makefile: 109; sed: 16
file content (61 lines) | stat: -rwxr-xr-x 1,469 bytes parent folder | download | duplicates (2)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH

umask 022

ACTION=$1

for DIR in /etc/ldm/rc.d /usr/share/ldm/rc.d @libexecdir@/ldm/rc.d ; do
    if [ -d "$DIR" ]; then
        RCDIRS="$RCDIRS $DIR"
    fi
done

case "${ACTION}" in
    init)
        # From ldm.c: LDM has just started, X is running, the greeter isn't.
        SCRIPTS="I*"
        ;;
    pressh)
        # From ssh.c: a username/password was provided, no connection yet.
        SCRIPTS="P*"
        ;;
    start)
        # From ssh.c: an ssh connection was established.
        SCRIPTS="S*"
        ;;
    xsession)
        # From plugin.c: an xsession was started (maybe even rdp).
        SCRIPTS="X*"
        ;;
    stop)
        # From screen.d/ldm.c: the xsession has ended.
        SCRIPTS="K*"
        ;;
esac

export TEXTDOMAIN=ldmrc

. /usr/bin/gettext.sh

# source ltsp client functions
if [ -f "/usr/share/ltsp/ltsp-client-functions" ]; then
    . /usr/share/ltsp/ltsp-client-functions
# source older common functions for backwards compatibility
elif [ -f "/usr/share/ltsp/ltsp-common-functions" ]; then
    . /usr/share/ltsp/ltsp-common-functions
fi

for SCRIPT in $(find -L $RCDIRS -type f -name "$SCRIPTS" -printf '%f\n' |
    tr ' ' '\n' | egrep ^[[:alnum:]_\-]*$ | sort -u)
do
    # only source the first instance of the script found
    for DIR in $RCDIRS ; do
        if [ -f "$DIR/$SCRIPT" ]; then
            . "$DIR/$SCRIPT"
            break
        fi
    done
done