5 # Helper for Changing Virtual Consoles #
7 # Get X to change back to the splash VT on exit #
8 # or chvt from silent splash VT to console to avoid blackscreen #
10 # Can determine changing direction from configuration and runlevel #
11 # when used with SysV-Init. #
13 # Author: Kurt J. Bosch <kjb-temp-2009 at alpenjodel.de> #
15 # Distributed under the terms of the GNU General Public License (GPL) #
17 # Make sure /proc/cmdline is parsed
20 .
/sbin
/splash-functions.sh
22 # Add miscsplashutils fgconsole path
23 [[ $spl_bindir ]] && PATH
+=":$spl_bindir"
25 # Defaults, Configuration
26 SPLASH_XCHVT_WAIT
=5 # seconds (undocumented setting)
28 .
/etc
/conf.d
/splash-extras
31 in silent
) splash_vt
=$SPLASH_TTY
32 ;; verbose
) splash_vt
=1
37 case $1 in -w |
--wait )
38 chvt_wait
=$SPLASH_XCHVT_WAIT
44 elif [[ -z $RUNLEVEL ]]; then
45 echo "$0: Error: RUNLEVEL not set in environment. Unable to determine action." >&2
47 elif [[ " "${SPLASH_XLEVELS[*]}" " = *" "$RUNLEVEL" "* ]]; then
53 fgc
=$
( fgconsole
) ||
exit 1
55 if [[ $1 = "splash" ]]; then
56 [[ $fgc = "$splash_vt" ]] && exit 0
57 echo "Changing to Splash VT (for starting X)"
59 elif [[ $1 =~ ^
[0-9]+$
]]; then
60 [[ $fgc = 1 ]] && exit 0
61 if [[ $fgc = "$splash_vt" ]]; then
63 elif (( chvt_wait
> 0 )); then
64 echo -n "Waiting for Splash VT to be activated (by terminated X)"
65 t
=$
(( chvt_wait
* 10 ))
66 until [[ $
( fgconsole
) = "$splash_vt" ]]; do
67 (( -- t
>= 0 )) && sleep .1 && continue
72 # If not on splash VT (after waiting until X changes), do nothing
76 echo "Changing from Splash VT to VT#: $1"
79 echo "Usage: ${0##*/} splash" >&2
80 echo " ${0##*/} [-w|--wait] [<vt-number>]" >&2