summaryrefslogtreecommitdiffstats
path: root/installmethod.py
blob: c5ea8716ee6d560e646a3821d5c06c6bed3a26f3 (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
#
# 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, shutil, string
from constants import *

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

import isys, product

def doMethodComplete(anaconda):
    try:
        isys.umount(anaconda.backend.ayum.tree)
    except Exception:
        pass

    if anaconda.methodstr.startswith("cdrom://"):
        try:
            shutil.copyfile("%s/media.repo" % anaconda.backend.ayum.tree,
                            "%s/etc/yum.repos.d/%s-install-media.repo" %(anaconda.rootPath, productName))
        except Exception, e:
            log.debug("Error copying media.repo: %s" %(e,))

    if anaconda.backend.ayum._loopbackFile:
        try:
            os.unlink(anaconda.backend.ayum._loopbackFile)
        except SystemError:
            pass

    if not anaconda.isKickstart and anaconda.mediaDevice:
        isys.ejectCdrom(anaconda.mediaDevice, 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()