~xnox/ubiquity/autopilot

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
# ubiquity - Ubuntu live CD installer
#
# 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.

description	"Ubuntu live CD installer"
author		"Ubuntu Installer Team <ubuntu-installer@lists.ubuntu.com>"

start on (starting gdm
	  or starting kdm
	  or starting xdm
	  or starting lxdm
	  or starting lightdm)
stop on (runlevel [06]
	 or stopping gdm
	 or stopping kdm
	 or stopping xdm
	 or stopping lxdm
	 or stopping lightdm)

task
normal exit 0 1

emits starting-dm

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

    ubiquity=
    automatic=
    debug=
    ldtp=
    noninteractive=
    choose=
    frontend=
    for x in $(cat /proc/cmdline); do
	case $x in
	    debug-ubiquity)
		debug="-d"
		ubiquity=1
		;;
	    automatic-ubiquity)
		automatic="--automatic"
		ubiquity=1
		;;
	    maybe-ubiquity)
		ubiquity=1
		choose="--greeter"
		;;
	    ldtp-ubiquity)
		ubiquity=1
		ldtp="--ldtp"
		;;
	    only-ubiquity)
		ubiquity=1
		;;
	    noninteractive)
		ubiquity=1
		noninteractive=1
		;;
	    ubiquity/frontend=*)
		frontend="${x#*=}"
		;;
	esac
    done
    [ "$ubiquity" ]

    if [ -r /etc/default/locale ]; then
        . /etc/default/locale
        if [ -n "$LANG" ]; then
            export LANG
        fi
        if [ -n "$LANGUAGE" ]; then
            export LANGUAGE
        fi
    fi

    initctl emit starting-dm DM=ubiquity-dm

    # turn off console blanking for install process
    setterm -blank 0 > /dev/console

    if [ -n "$noninteractive" ]; then
	plymouth quit || :
	exec ubiquity noninteractive $debug
    else
	if ! ubiquity-dm vt7 :0 ubuntu /usr/bin/ubiquity $debug $automatic $choose $ldtp --only $frontend; then
	    # has X crashed, or has ubiquity?
            if [ "$automatic" ] && ! [ -f /var/log/installer/version ]; then
                # in case we crashed before the X startup sequence
                plymouth quit || :
                exec ubiquity noninteractive $debug
            else
                # something more serious has happened, e.g. debconf locked?!
                exit 1
            fi
	fi
    fi
    exit 0
end script