~guadalinex-members/casper-guada/casper-guada-jdev

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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#! /bin/sh
### BEGIN INIT INFO
# Provides:          ubiquity
# Required-Start:    $remote_fs $syslog $time hal
# Required-Stop:     $remote_fs $syslog $time hal
# X-Start-Before:    gdm kdm xdm
# X-Stop-After:      gdm kdm xdm
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: Ubuntu live CD installer
# Description:       Installs Ubuntu from a live CD. This only does anything
#                    if told to do so by parameters on the kernel command
#                    line; otherwise, the installer may be started manually
#                    later.
### END INIT INFO

set -e

PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=ubiquity

test -x /usr/bin/ubiquity-dm || exit 0

ubiquity=
automatic=
debug=
noninteractive=
for x in $(cat /proc/cmdline); do
	case $x in
		debug-ubiquity)
			debug="-d"
			ubiquity=1
			;;
		automatic-ubiquity)
			automatic="--automatic"
			ubiquity=1
			;;
		only-ubiquity)
			ubiquity=1
			;;
		noninteractive)
			ubiquity=1
			noninteractive=1
			;;
	esac
done
if [ -z "$ubiquity" ] && [ "$1" != force-start ]; then
	exit 0
fi
    
if [ -r /etc/environment ]; then
	if LANG=$(pam_getenv -l LANG); then
		export LANG
	fi
	if LANGUAGE=$(pam_getenv -l LANGUAGE); then
		export LANGUAGE
	fi
fi

. /lib/lsb/init-functions

case "$1" in
	start|force-start)
		if [ -x /etc/init.d/NetworkManager ]; then
			/etc/init.d/NetworkManager start
		elif [ -x /etc/init.d/network-manager ]; then
			/etc/init.d/network-manager start
		fi
		log_begin_msg "Starting Ubiquity..."
		# if usplash is running, make sure to stop it now, yes "start" kills it.
		if pidof usplash > /dev/null; then
			usplash=:
			orig_console="$(fgconsole)"
			DO_NOT_SWITCH_VT=yes /etc/init.d/usplash start
			# We've just shut down usplash, so don't log
			# success as it will look weird on the console.
			log_end_msg=:
		else
			usplash=false
			log_end_msg=log_end_msg
		fi
		# turn off console blanking for install process
		setterm -blank 0
		if [ -n "$noninteractive" ]; then
			cmd="ubiquity noninteractive"
		else
			# check if there was any frontend specified
			frontend=$(awk '{for (i=1;i<=NF;i++)  if ( $i ~ "ubiquity-ui" ) split($i,array,"="); print array[2]}' /proc/cmdline)
			# Run in the foreground.
			cmd="ubiquity-dm vt7 :0 /usr/bin/ubiquity $debug $automatic --only $frontend"
			if ${cmd}; then
				cmd="/bin/true"
			else
				cmd="ubiquity noninteractive"
			fi
		fi
		if ${cmd}; then
			$log_end_msg 0
		else
			log_end_msg $?
		fi

		if $usplash && [ "$orig_console" != serial ]; then
			# Wait a short while for the active console to
			# change, to try to avoid visible console noise from
			# later init scripts.
			i=0
			while [ "$(fgconsole)" = "$orig_console" ]; do
				i="$(($i + 1))"
				if [ "$i" -gt 5 ]; then
					break
				fi
				sleep 1
			done
		fi
	;;
	stop|restart|force-reload)
	;;
	*)
		N=/etc/init.d/$NAME
		echo "Usage: $N {start|force-start|stop|restart|force-reload}" >&2
		exit 1
	;;
esac

exit 0