File: ltsp-client.init

package info (click to toggle)
ltsp 0.99debian11%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 972 kB
  • ctags: 103
  • sloc: sh: 1,320; python: 485; ansic: 436; lex: 152; makefile: 129; yacc: 58
file content (102 lines) | stat: -rw-r--r-- 2,631 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#! /bin/sh
#
# Author:	Matt Zimmerman <mdz@ubuntu.com>
#
### BEGIN INIT INFO
# Provides:          ltsp-client
# Required-Start:    ltsp-client-setup $network $syslog
# Required-Stop:     ltsp-client-setup $network $syslog
# Should-Start:      xdebconfigurator
# Default-Start:     2 3 4 5
# Default-Stop:      S 0 1 6
# Short-Description: Script for LTSP client initialization
# Description:
### END INIT INFO

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="LTSP client"
NAME=ltsp-client
SCRIPTNAME=/etc/init.d/$NAME

# Gracefully exit if the package has been removed.
test -f /usr/lib/ltsp/ltsp_functions || exit 0
# Gracefully exit if ltsp_chroot file is not present
test -f /etc/ltsp_chroot || exit 0

. /lib/lsb/init-functions
. /usr/lib/ltsp/ltsp_functions
. /usr/lib/ltsp/ltsp_config

warn() {
    msg="$1"
    logger -p user.warning -t ltsp-client  "warning: $msg"
}

start_sound() {
    if boolean_is_true "$SOUND" ; then
        # Detect and report a common problem with thin clients
		if [ ! -f /dev/dsp ] ; then
		    warn "Sound requested but /dev/dsp is missing.  Continuing."
		fi
		case "$SOUND_DAEMON" in
    	    esd|'') # The default when no value is set
    	        /usr/bin/esd -nobeeps -public -tcp &
    	        ;;
    	    nasd)
    	        /usr/bin/nasd -aa &
    	        # Line copied from old LTSP:  Should we use it? [pere 2006-03-03]
    	        #aumix-minimal -v100 -w100 -c90 -m10
    	        ;;
    	    *)
    	        warn "Unable to start unsupported sound daemon: '$SOUND_DAEMON'"
    	        ;;
    	esac
    fi
}

case "$1" in
  start)
  # if usplash is runing, make sure to stop it now 
  # (yes "start" is the right arg to do it ... even it looks silly)
  		if pidof usplash > /dev/null; then
			/etc/init.d/usplash start
		fi
        log_begin_msg "Starting LTSP client..."

        start_sound || true

        for screen in $(env | awk -F= '$1 ~ /^SCREEN_/ { print $1 }'); do
            num=${screen##SCREEN_}
            start-stop-daemon --start -b --exec /usr/lib/ltsp/screen_session -- "$num"
        done
        

        log_end_msg 0
	;;
  stop)
#	echo -n "Stopping $DESC: $NAME"
#	d_stop
#	echo "."
	;;
  restart|force-reload)
	#
	#	If the "reload" option is implemented, move the "force-reload"
	#	option to the "reload" entry above. If not, "force-reload" is
	#	just the same as "restart".
	#
	echo -n "Restarting $DESC: $NAME"
	d_stop
	sleep 1
	d_start
	echo "."
	;;
  *)
	# echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0