summaryrefslogtreecommitdiffstats
path: root/backend.py
blob: 7339e264ebcc05cd99cf482edd78de6aa88e45fa (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
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
#
# backend.py: Interface for installation backends
#
# Paul Nasrat <pnasrat@redhat.com> 
# Copyright (c) 2005 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

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

class ProxyBackend:
    def __init__(self, object=None):
        self.object = object

    def __getattr__(self, attr):
        if self.object:
            return getattr(self.object, attr)

class AnacondaBackend:
    def __init__(self, method):
        self.method = method
        self.instLog = None
        self.modeText = ""

    def doPreSelection(self, intf, id, instPath):
        pass

    def doPostSelection(self, intf, id, instPath):
        pass

    def doPreInstall(self, intf, id, instPath, dir):
        pass

    def doPostInstall(self, intf, id, instPath):
        pass

    def doInstall(self, intf, id, instPath):
        pass

    def initLog(self, id, instPath):
        upgrade = id.getUpgrade()

        if upgrade:
            logname = '/root/upgrade.log'
        else:
            logname = '/root/install.log'

        instLogName = instPath + logname
        try:
            iutil.rmrf (instLogName)
        except OSError:
            pass

        instLog = open(instLogName, "w+")
        if upgrade:
            logname = '/root/upgrade.log'
        else:
            logname = '/root/install.log'

        instLogName = instPath + logname
        try:
            iutil.rmrf (instLogName)
        except OSError:
            pass

        self.instLog = open(instLogName, "w+")

       # dont start syslogd if we arent creating filesystems
        if flags.setupFilesystems:
            syslogname = "%s%s.syslog" % (instPath, logname)
            try:
                iutil.rmrf (syslogname)
            except OSError:
                pass
            syslog.start (instPath, syslogname)
        else:
            syslogname = None

        if upgrade:
            self.modeText = _("Upgrading %s-%s-%s.%s.\n")
        else:
            self.modeText = _("Installing %s-%s-%s.%s.\n")