source: lliurex-rpi-packages/trunk/fuentes/ldm/ltsp/screen_session @ 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.5 KB
Line 
1#!/bin/sh
2#
3#  Copyright (c) 2002 McQuillan Systems, LLC
4#
5#  Author: James A. McQuillan <jam@McQuil.com>
6#
7#  2005, Matt Zimmerman <mdz@canonical.com>
8#  2006, Oliver Grawert <ogra@canonical.com>
9#  2007, Scott Balneaves <sbalneav@ltsp.org>
10#  2008, Warren Togami <wtogami@redhat.com>
11#        Stephane Graber <stgraber@ubuntu.com>
12#        Vagrant Cascadian <vagrant@freegeek.org>
13#        Gideon Romm <ltsp@symbio-technologies.com>
14#  2012, Alkis Georgopoulos <alkisg@gmail.com>
15#
16#  This program is free software; you can redistribute it and/or
17#  modify it under the terms of the GNU General Public License as
18#  published by the Free Software Foundation; either version 2 of the
19#  License, or (at your option) any later version.
20#
21#  This program is distributed in the hope that it will be useful,
22#  but WITHOUT ANY WARRANTY; without even the implied warranty of
23#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24#  GNU General Public License for more details.
25#
26#  You should have received a copy of the GNU General Public License
27#  along with this program.  If not, you can find it on the World Wide
28#  Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
29#  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
30#  MA 02110-1301, USA.
31#
32
33# Load LTSP configuration
34# ltsp_config sources ltsp-client-functions
35. /usr/share/ltsp/ltsp_config
36
37case "$1" in
38    [0-1][0-9])
39        num="$1"
40        ;;
41    *)
42        die "Usage: $0 [01..12]"
43        ;;
44esac
45
46while true; do
47    # Wait until this is the active vt before launching the screen script
48    while [ $(fgconsole) -ne "$num" ]; do
49        sleep 2
50    done
51
52    if [ -f /etc/ltsp/getltscfg-cluster.conf ]; then
53        # Reset the environement
54        unset $(env | egrep '^(\w+)=(.*)$' | egrep -vw 'PWD|USER|PATH|HOME' | /usr/bin/cut -d= -f1)
55        . /usr/share/ltsp/ltsp_config
56        eval $(getltscfg-cluster -a -l prompt)
57    fi
58
59    read script args <<EOF
60$(eval echo "\$SCREEN_$num")
61EOF
62
63    # Screen scripts in /etc override those in /usr
64    unset script_path
65    for dir in /etc/ltsp/screen.d /usr/share/ltsp/screen.d; do
66        if [ -x "$dir/$script" ]; then
67            script_path="$dir/$script"
68            break
69        fi
70    done
71    if [ -z "$script_path" ]; then
72        die "Script '$script' for SCREEN_$num was not found"
73    fi
74
75    for script in $(run_parts_list /usr/share/ltsp/screen-session.d/ S); do
76        . "$script"
77    done
78    "$script_path" "$args"
79    for script in $(run_parts_list /usr/share/ltsp/screen-session.d/ K); do
80        . "$script"
81    done
82done
Note: See TracBrowser for help on using the repository browser.