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
|
#
# installmethod.py - Base class for install methods
#
# Copyright 1999-2007 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 os
import string
from constants import *
import logging
log = logging.getLogger("anaconda")
## The base installation method class.
# This is an abstract class that defines the methods that make up an
# installation method. This class should not be used except as the superclass
# for a specific method. Most methods in this class should be redefined by
# subclasses, though things like mountCD, unmountCD, ejectCD, and the cleanup
# methods may not need to be redefined. By default, most methods pass.
class InstallMethod:
## Perform method-specific actions to mount any installation media.
# @param fsset An instance of FileSystemSet.
# @param mntPoint The root of the filesystem to mount the media onto.
def systemMounted(self, fsset, mntPoint):
pass
## Method-specific cleanup function to be called at the end of installation.
# @see doMethodComplete
# @see postAction
def filesDone(self):
pass
## The constructor.
# @param method The --method= parameter passed to anaconda from loader.
# @param rootpath The --rootpath= parameter passed to anaconda from loader.
# @param intf An instance of the InstallInterface class.
def __init__(self, method, rootpath, intf):
self.rootPath = rootpath
self.intf = intf
self.tree = None
## Get the base URI for the method.
# @return The base URI for this installation method.
def getMethodUri(self):
pass
## Unmount any CD media.
def unmountCD(self):
pass
## Switch CDs.
# @param mediano The CD media number to switch to.
# @param filename The file to be read that requires switching media.
def switchMedia(self, mediano, filename=""):
pass
## Method to be run at the very end of installation.
#
# This method is run very late. It's the last step to be run before
# showing the completion screen. Only use this if you really know what
# you're doing.
# @param anaconda An instance of the Anaconda class.
# @see filesDone
# @see doMethodComplete
def postAction(self, anaconda):
pass
## Do method-specific cleanups.
#
# This occurs very late and is mainly used for unmounting media and ejecting
# the CD. If we're on a kickstart install, don't eject the CD since there's
# a kickstart command to do that.
# @param anaconda An instance of the Anaconda class.
# @see InstallMethod::postAction
# @see InstallMethod::filesDone
def doMethodComplete(anaconda):
anaconda.method.filesDone()
if not anaconda.isKickstart:
isys.ejectCdrom(anaconda.method.device, makeDevice=1)
mtab = "/dev/root / ext3 ro 0 0\n"
for ent in anaconda.id.fsset.entries:
if ent.mountpoint == "/":
mtab = "/dev/root / %s ro 0 0\n" %(ent.fsystem.name,)
f = open(anaconda.rootPath + "/etc/mtab", "w+")
f.write(mtab)
f.close()
|