|
|
|
@ -48,7 +48,7 @@ yesno()
|
|
|
|
|
case "$value" in
|
|
|
|
|
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0;;
|
|
|
|
|
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1;;
|
|
|
|
|
*) warn "Invalid value for \`$1'; falling back to \`no' for now.";;
|
|
|
|
|
*) warn "invalid value for \`$1'; falling back to \`no' for now.";;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -83,7 +83,7 @@ cktimeout=${cktimeout:-30}
|
|
|
|
|
serverargs=${serverargs:-'-nolisten tcp'}
|
|
|
|
|
|
|
|
|
|
# Offer all available sessions in /etc/X11/Sessions,
|
|
|
|
|
# if binlist if not explicitly set in cdmrc.
|
|
|
|
|
# if $binlist if not explicitly set in cdmrc.
|
|
|
|
|
|
|
|
|
|
if [[ "${#binlist[@]}" == 0 ]]; then
|
|
|
|
|
binlist=($(find /etc/X11/Sessions -maxdepth 1 -type f))
|
|
|
|
@ -121,13 +121,14 @@ case ${flaglist[$binindex]} in
|
|
|
|
|
# *C*onsole programs.
|
|
|
|
|
[Cc])
|
|
|
|
|
clear
|
|
|
|
|
|
|
|
|
|
# If $bin is a login shell, it might `exec' cdm again, causing an endless
|
|
|
|
|
# loop. To solve this problem, export $CDM_SPAWN when `exec'ing $bin and
|
|
|
|
|
# only let the shell automatically `exec' cdm when $CDM_SPAWN is not set.
|
|
|
|
|
# See also the example shell profile file shipped with the cdm package.
|
|
|
|
|
|
|
|
|
|
# Also untrap SIGINT and SIGTSTP before spawning process: If this is not
|
|
|
|
|
# done, *ANY* child process of *ANY* child (bash) shell will completely
|
|
|
|
|
# done, any child process of any child (bash) shell will completely
|
|
|
|
|
# ignore SIGINT, which is rather confusing, and cannot be undone.
|
|
|
|
|
|
|
|
|
|
trap - SIGINT SIGTSTP
|
|
|
|
@ -138,12 +139,10 @@ case ${flaglist[$binindex]} in
|
|
|
|
|
[Xx])
|
|
|
|
|
clear
|
|
|
|
|
|
|
|
|
|
# If X is already running and locktty=yes, activate it
|
|
|
|
|
if $(yesno locktty); then
|
|
|
|
|
if xdpyinfo -display ":$display.0" &> /dev/null; then
|
|
|
|
|
chvt "$((display+xtty))"
|
|
|
|
|
exitnormal
|
|
|
|
|
fi
|
|
|
|
|
# If X is already running and locktty=yes, activate it.
|
|
|
|
|
if $(yesno locktty) && xdpyinfo -display ":$display.0" &> /dev/null; then
|
|
|
|
|
chvt "$((display+xtty))"
|
|
|
|
|
exitnormal
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Get the first empty display.
|
|
|
|
@ -161,17 +160,16 @@ case ${flaglist[$binindex]} in
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# run X in current tty
|
|
|
|
|
if [[ $xtty == "keep" ]]; then
|
|
|
|
|
vt=$(tty)
|
|
|
|
|
vt=${vt#/dev/}
|
|
|
|
|
if [[ $vt != tty* ]]; then
|
|
|
|
|
error "error: invalid TTY"
|
|
|
|
|
# Support for running X in current tty.
|
|
|
|
|
if [[ $xtty == 'keep' ]]; then
|
|
|
|
|
vt="$(tty)"
|
|
|
|
|
if [[ "$vt" != '/dev/tty'* ]]; then
|
|
|
|
|
error 'invalid TTY.'
|
|
|
|
|
exiterror
|
|
|
|
|
fi
|
|
|
|
|
vt=${vt#tty}
|
|
|
|
|
vt="${vt#/dev/tty}"
|
|
|
|
|
else
|
|
|
|
|
vt=$((xtty+display))
|
|
|
|
|
vt="$((xtty+display))"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
serverargs=":${display} $serverargs vt$vt"
|
|
|
|
|