summaryrefslogtreecommitdiffstats
path: root/pyanaconda/script.py
blob: c4e0074f0623c7bf3356ce951fc0ab5b24b2d1c8 (plain)
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
#
# script.py - non-interactive, script based anaconda interface
#
# Copyright (C) 2011
# Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Author(s): Brian C. Lane <bcl@redhat.com>
#

from installinterfacebase import InstallInterfaceBase
import cmdline
from cmdline import setupProgressDisplay

import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)

import logging
log = logging.getLogger("anaconda")

stepToClasses = { "install" : "setupProgressDisplay",
                  "complete": "Finished" }

class InstallInterface(cmdline.InstallInterface):
    def enableNetwork(self):
        # Assume we want networking
        return True

    def display_step(self, step):
        if stepToClasses.has_key(step):
            s = "nextWin = %s" % (stepToClasses[step],)
            exec s
            nextWin(self.anaconda)
        else:
            errtxt = _("In interactive step can't continue. (%s)" % (step,))
            print(errtxt)
            raise RuntimeError(errtxt)

def Finished(anaconda):
    """ Install is finished. Lets just exit.
    """
    return 0