source: lliurex-rpi-packages/trunk/fuentes/ldm/S99ltsp @ 2328

Last change on this file since 2328 was 2328, checked in by kbut, 3 years ago

add new package

  • Property svn:executable set to *
File size: 2.8 KB
Line 
1#!/bin/sh
2#
3# Quick & dirty LTSP startup script
4# Author: Floris Bos
5#
6
7case "$1" in
8  start)
9    export XAUTHORITY=/var/run/Xauthority
10    export DISPLAY=:0
11    export LOCALE=C
12   
13    export LDM_THEME=ltsp
14    export LANG=en_US.UTF-8
15    export LANGUAGE=en_US.UTF-8
16    export LDM_LANGUAGE=en_US.UTF-8
17    export LDM_DIRECTX=True
18    export SOUND=True
19   
20    # FIXME: should introduce a way to embed keys in image to prevent man-in-the-middle scenario
21    export LDM_SSHOPTIONS="-o StrictHostKeyChecking=no -o CheckHostIP=no"
22
23    # FIXME: check if this improves performance on boards other than the RPi. If not do a /proc/cpuinfo check
24    export LD_PRELOAD=/usr/lib/libcofi_rpi.so
25       
26    # LTSP acts as DHCP server.  /usr/share/uhdcpc/default.script has been modified to save server IP in /tmp/siaddr
27    LDM_SERVER=`cat /tmp/siaddr`
28
29    # Disable (reverse) DNS lookups
30    echo "" >/etc/resolv.conf
31   
32    # If there is a "server=1.2.3.4" kernel parameter use that instead
33    # Allow the default language to be overridden too.
34    for x in `cat /proc/cmdline`
35    do
36        case $x in
37            server=*)
38            LDM_SERVER=${x//server=}
39            ;;
40            berryconsole)
41            /sbin/getty -L tty2 0 vt100 &
42            ;;
43            LDM*)
44            export $x
45            ;;
46            LANG=*)
47            export LANG=${x//LANG=}
48            export LANGUAGE=${x//LANG=}
49            export LDM_LANGUAGE=${x//LANG=}
50            ;;
51        esac
52    done
53    export LDM_SERVER
54
55    if [ -z "${LDM_SERVER}" ]; then
56        echo "Error obtaining IP from DHCP server"
57        echo
58        exit 1
59    fi
60
61    echo "Retrieving LDM settings from ${LDM_SERVER}"
62    mkdir /var/run/ldm
63    nc -w 5 ${LDM_SERVER} 9571 > /var/run/ldm/${LDM_SERVER}
64   
65    if [ ! -s /var/run/ldm/${LDM_SERVER} ]; then
66        echo "Error retrieving LDM settings from ${LDM_SERVER}. Not a LTSP server?"
67        echo
68        echo "Note: you can manually specify the LTSP server by putting 'server=1.2.3.4' in cmdline.txt"
69        echo
70        exit 1
71    fi
72
73    echo "Initializing sound"
74    if [ -e /lib/modules/`uname -r`/kernel/sound/arm/snd-bcm2835.ko ]; then
75        modprobe snd-bcm2835
76    fi
77    adduser -D -H pulse 2>/dev/null
78    chown pulse /dev/snd/*
79    pulseaudio --system --exit-idle-time=-1 --disable-shm --no-cpu-limit \
80                --resample-method=trivial --high-priority --log-target=syslog \
81                -L "module-esound-protocol-tcp auth-ip-acl=${LDM_SERVER}" \
82                -L "module-native-protocol-tcp auth-ip-acl=${LDM_SERVER}" &
83   
84    MCOOKIE=$(mcookie)
85    xauth -q add ${DISPLAY} . ${MCOOKIE} 2>/dev/null
86    clear
87    echo "Starting X"
88
89    while true
90    do
91        Xorg -auth $XAUTHORITY &
92        ldm
93        killall Xorg
94        clear
95        echo "Restarting X and LDM"
96        sleep 1
97    done
98    ;;
99
100  *)
101    exit 0
102esac
103
104exit $?
Note: See TracBrowser for help on using the repository browser.