File: usplash.init

package info (click to toggle)
usplash 0.3e
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 852 kB
  • ctags: 739
  • sloc: ansic: 7,936; sh: 254; makefile: 173; perl: 26
file content (84 lines) | stat: -rwxr-xr-x 2,208 bytes parent folder | download
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
#! /bin/sh
# 
# The usplash script makes sure that usplash exits at the end of 
# the boot sequence and re-run the console-screen.sh script to make
# sure that the console fonts are actually set
#
#		Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#		Modified for Debian 
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version:	@(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/sbin/usplash
NAME=usplash
DESC="Userspace bootsplash utility"

test -x $DAEMON || exit 0

set -e

usplash_quit() {
	# first some sanity checks if we actually have usplash on the system
	# 
	# check if usplash is runing and if it does, exit it
	# then re-run console-screen.sh because it can't set console-fonts
	# properly while the screen is in graphics mode
	# 
	# also check if we are ended up in console 8. This means that 
	# no gdm/kdm/xdm was started (otherwise we would be on vt7).
	# It happens when e.g. usplash timed out
	CONSOLE_SCREEN=/etc/init.d/console-screen.sh
	if [ -x $CONSOLE_SCREEN ] && type usplash >/dev/null 2>&1 && 
           grep -q splash /proc/cmdline &&
           ( pidof usplash > /dev/null || [ "$(fgconsole 2>/dev/null)" = "8" ] ); then
		# disable the cursor, for a nice black screen to sit on to avoid
		# text flicker on the user's screen while we're killing usplash
		clear > /dev/tty1
		#echo "[?25l" > /dev/tty1
	        chvt 1

		# ask usplash to go away
		usplash_write QUIT

		# wait until it is really gone or kill it if it dosn't exit
		i=0
		while pidof usplash > /dev/null; do
			i=$(($i + 1))
			if [ $i -gt 10 ]; then
				kill -9 `pidof usplash`
				break
			fi
			sleep 1
		done

		# and, finally, reset all our virtual consoles, yay!
		$CONSOLE_SCREEN
		# re-enable that cursor, s'il vous plait
		clear > /dev/tty1
		#echo "[?25h" > /dev/tty1
		chvt 1
	fi
}

case "$1" in
  start)
	usplash_quit
	;;
  stop)
  	usplash -c &
	usplash_write "TEXT Resetting the usplash timeout..."
	usplash_write "TIMEOUT 15"
	usplash_write "SUCCESS ok"
	;;
  *)
	N=/etc/init.d/$NAME
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $N {start|stop}" >&2
	exit 1
	;;
esac

exit 0