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
|
#!/bin/sh
#
# Copyright (c) 2008 Gideon Romm <ltsp@symbio-technologies.com>
#
# 2008, Vagrant Cascadian <vagrant@freegeek.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, you can find it on the World Wide
# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
. /usr/share/ltsp/ltsp-common-functions
XINITRCDIR=/usr/share/ltsp/xinitrc.d
COMMAND=$*
export COMMAND
# use run-parts to source every file in the xinitrc directory; we source
# instead of executing so that the variables and functions defined above
# are available to the scripts, and so that they can pass variables to each
# other
XINITRCFILES=$(run_parts_list $XINITRCDIR)
if [ -n "$XINITRCFILES" ]; then
set +e
for XINITRCFILE in $XINITRCFILES; do
. $XINITRCFILE
done
set -e
fi
if boolean_is_true "$XINITRC_DAEMON"; then
set +e
# Make the arrow aa bit more presentable. :)
xsetroot -cursor_name top_left_arrow
unset BREAK_LOOP
while [ -z "$BREAK_LOOP" ]; do
eval $COMMAND
ret=$?
if [ "$ret" != "0" ]; then
if [ -z "$XINITRC_COMMAND_ON_ERROR" ]; then
XINITRC_COMMAND_ON_ERROR="ldm-dialog --message \"An error has occured.\""
fi
if boolean_is_true "$XINITRC_PROMPT_ON_ERROR"; then
for i in $XINITRC_ERROR_CODES; do
if [ "$i" = "$ret" ]; then
eval ${XINITRC_COMMAND_ON_ERROR} 2>/dev/null || true
fi
done
fi
else
if boolean_is_true "$XINITRC_PROMPT_ON_EXIT"; then
ldm-dialog --question "Would you like to start this session?" 2>/dev/null || true
[ "$?" != 0 ] && BREAK_LOOP=1
fi
fi
done
[ -n "$XINITRC_COMMAND_ON_EXIT" ] && eval ${XINITRC_COMMAND_ON_EXIT}
set -e
else
eval exec $COMMAND
fi
|