File: ldm-script.in

package info (click to toggle)
ldm 2%3A2.2.11-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,352 kB
  • sloc: ansic: 4,224; sh: 2,938; python: 259; makefile: 112; sed: 16
file content (55 lines) | stat: -rwxr-xr-x 1,356 bytes parent folder | download
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
#! /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

SCRIPTS=
case "${ACTION}" in
    pressh)
        SCRIPTS="$(find -L $RCDIRS -type f -name 'P*' -printf '%f\n')"
        ;;
    start)
        SCRIPTS="$(find -L $RCDIRS -type f -name 'S*' -printf '%f\n')"
        ;;
    stop)
        SCRIPTS="$(find -L $RCDIRS -type f -name 'K*' -printf '%f\n')"
        ;;
    init)
        SCRIPTS="$(find -L $RCDIRS -type f -name 'I*' -printf '%f\n')"
        ;;
    xsession)
        SCRIPTS="$(find -L $RCDIRS -type f -name 'X*' -printf '%f\n')"
        ;;
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 $(echo ${SCRIPTS} | tr ' ' '\n'| egrep ^[0-9a-zA-Z_\-]*$ | 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