File: ltsp-remoteappsd

package info (click to toggle)
ltsp 5.5.4-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,440 kB
  • ctags: 359
  • sloc: sh: 5,106; ansic: 1,590; perl: 280; python: 197; makefile: 171; lex: 152; yacc: 59
file content (35 lines) | stat: -rwxr-xr-x 1,130 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
#!/bin/sh

if [ -z "$DISPLAY" ];then 
    exit 1
fi

# Initialize LTSP_RCOMMAND as blank
reset_xprop(){
    xprop -root -f $1 8s -set $1 ""
}

reset_xprop LTSP_RCOMMAND
reset_xprop LTSP_RCOMMAND_WAIT

# Poll for LTSP_RCOMMAND changes and execute
xprop -notype -root -spy LTSP_RCOMMAND | while read junk_x junk_y LTSP_RCOMMAND ; do

    # Strip off leading and trailing double-quotes.
    LTSP_RCOMMAND=${LTSP_RCOMMAND%\"}
    LTSP_RCOMMAND=${LTSP_RCOMMAND#\"}

    # If empty, nothing to execute, return to the loop.
    test -n "${LTSP_RCOMMAND}" || continue

    LTSP_RCOMMAND_WAIT=$(xprop -root -notype LTSP_RCOMMAND_WAIT |sed -e 's/^LTSP_RCOMMAND_WAIT = //' -e 's/^"//' -e 's/"$//')
    if [ -n "${LTSP_RCOMMAND}" ]; then
        if [ "$LTSP_RCOMMAND_WAIT" = "true" ]; then
            ssh -Y -t -S ${LDM_SOCKET} ${LDM_SERVER} "$CLIENT_ENV $MY_LANG $MY_DISP $MY_SCANNER $MY_SOUND ${LTSP_RCOMMAND}"
        else
            ssh -Y -t -S ${LDM_SOCKET} ${LDM_SERVER} "$CLIENT_ENV $MY_LANG $MY_DISP $MY_SCANNER $MY_SOUND ${LTSP_RCOMMAND}" & 
        fi
    fi
    reset_xprop LTSP_RCOMMAND
    reset_xprop LTSP_RCOMMAND_WAIT
done