We don't have to do urlinstall here and we don't have to mount any media here, either.
# a RAID or LVM device (#107319)
# 5) the drive contains protected partitions and initAll is set
if ((linuxOnly == 0) or (ptype and ptype.isLinuxNativeFS()) or
- (initAll and
- partedUtils.hasProtectedPartitions(drive, pomona)) or
(not ptype and
partedUtils.isLinuxNativeByNumtype(part.native_type)) or
((part.native_type == -1) and # the ptable doesn't have types
if pomona.dir == DISPATCH_BACK:
diskset.refreshDevices()
partitions.setFromDisk(diskset)
- partitions.setProtected(pomona.dispatch)
partitions.autoPartitionRequests = []
return
# restore drives to original state
diskset.refreshDevices()
partitions.setFromDisk(diskset)
- partitions.setProtected(pomona.dispatch)
pomona.dispatch.skipStep("partition", skip = 0)
pomona.intf.messageWindow(_("Error Partitioning"),
_("Could not allocate requested partitions: \n\n"
log = logging.getLogger("pomona")
class PomonaBackend:
- def __init__(self, method, instPath):
+ def __init__(self, instPath):
"""Abstract backend class all backends should inherit from this
- @param method: Object of InstallMethod type
@param instPath: root path for the installation to occur"""
- self.method = method
self.instPath = instPath
self.modeText = ""
from packages import doMigrateFilesystems
from packages import doPostAction
from packages import copyPomonaLogs
-#
-#from flags import flags
-#from installmethod import doMethodComplete
+
+from flags import flags
#from backend import doPostSelection, doRepoSetup, doBasePackageSelect
from backend import doPreInstall, doPostInstall, doInstall
("betanag", betaNagScreen, ),
("language", ),
("keyboard", ),
- ("source", ),
("partitionobjinit", partitionObjectsInitialize, ),
("parttype", ),
("autopartitionexecute", doAutoPartition, ),
("writeconfig", writeConfiguration, ),
("instbootloader", writeBootloader, ),
("copylogs", copyPomonaLogs, ),
- #("methodcomplete", doMethodComplete, ),
#("postscripts", runPostScripts, ),
("dopostaction", doPostAction, ),
("complete", ),
self.pomona.dir = DISPATCH_FORWARD
self.step = None
self.skipSteps = {}
-
- self.method = pomona.method
self.firstStep = 0
def _getDir(self):
+++ /dev/null
-#
-# harddrive.py - Install method for hard drive installs
-#
-# Copyright 1999-2006 Red Hat, Inc.
-#
-# This software may be freely redistributed under the terms of the GNU
-# General Public License.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-
-from installmethod import InstallMethod, FileCopyException
-from image import findIsoImages, ImageInstallMethod
-import shutil
-import os
-import sys
-import isys
-import iutil
-import string
-from rhpl.translate import _, cat, N_
-from constants import *
-
-import logging
-log = logging.getLogger("pomona")
-
-# Install from one or more iso images
-class HardDriveInstallMethod(InstallMethod):
- def getMethodUri(self):
- return "file://%s" % self.tree
-
- def copyFileToTemp(self, filename):
- wasmounted = self.mediaIsMounted
- self.switchMedia(1, filename)
-
- path = ImageInstallMethod.copyFileToTemp(self, filename)
-
- self.switchMedia(wasmounted)
- return path
-
- def badPackageError(self, pkgname):
- return _("The file %s cannot be opened. This is due to a missing "
- "file or perhaps a corrupt package. Please verify your "
- "installation images and that you have all the required "
- "media.\n\n"
- "If you reboot, your system will be left in an inconsistent "
- "state that will likely require reinstallation.\n\n") % pkgname
-
-# mounts disc image cdNum under self.tree
- def mountMedia(self, cdNum):
- if self.mediaIsMounted:
- raise SystemError, "trying to mount already-mounted iso image!"
-
- self.mountDirectory()
-
- retry = True
- while retry:
- try:
- isoImage = self.isoDir + '/' + self.path + '/' + self.discImages[cdNum]
-
- isys.makeDevInode("loop3", "/tmp/loop3")
- isys.losetup("/tmp/loop3", isoImage, readOnly = 1)
-
- isys.mount("loop3", self.tree, fstype = 'iso9660', readOnly = 1);
- self.mediaIsMounted = cdNum
-
- retry = False
- except:
- ans = self.messageWindow(_("Missing ISO 9660 Image"),
- _("The installer has tried to mount "
- "image #%s, but cannot find it on "
- "the hard drive.\n\n"
- "Please copy this image to the "
- "drive and click Retry. Click Reboot "
- " to abort the installation.")
- % (cdNum,), type="custom",
- custom_icon="warning",
- custom_buttons=[_("_Reboot"),
- _("Re_try")])
- if ans == 0:
- sys.exit(0)
- elif ans == 1:
- self.discImages = findIsoImages(self.isoPath, self.messageWindow)
-
- def umountMedia(self):
- if self.mediaIsMounted:
- isys.umount(self.tree)
- isys.makeDevInode("loop3", "/tmp/loop3")
- isys.unlosetup("/tmp/loop3")
- self.umountDirectory()
- self.mediaIsMounted = 0
-
- # This mounts the directory containing the iso images, and places the
- # mount point in self.isoDir. It's only used directly by __init__;
- # everything else goes through switchMedia
- def mountDirectory(self):
- if (self.isoDirIsMounted):
- raise SystemError, "trying to mount already-mounted image!"
-
- f = open("/proc/mounts", "r")
- l = f.readlines()
- f.close()
-
- for line in l:
- s = string.split(line)
- if s[0] == "/dev/" + self.device:
- self.isoDir = s[1] + "/"
- return
-
- try:
- isys.mount(self.device, "/tmp/isodir", fstype = self.fstype,
- readOnly = 1);
- except SystemError, msg:
- log.error("couldn't mount ISO source directory: %s" % msg)
- self.messageWindow(_("Couldn't Mount ISO Source"),
- _("An error occurred mounting the source "
- "device %s. This may happen if your ISO "
- "images are located on an advanced storage "
- "device like LVM or RAID, or if there was a "
- "problem mounting a partition. Click reboot "
- "to abort the installation.")
- % (self.device,), type="custom",
- custom_icon="error",
- custom_buttons=[_("_Reboot")])
- sys.exit(0)
-
-
- self.isoDir = "/tmp/isodir/"
- self.isoDirIsMounted = 1
-
- def umountDirectory(self):
- if self.isoDirIsMounted:
- isys.umount(self.isoDir)
- self.isoDirIsMounted = 0
-
- # return reference to file specified on ISO #1
- # mounts ISO #1, copies file to destdir, umounts ISO #1
- # will probably do bad things if called during package installation
- # returns None if file doesn't exist
- def getFilename(self, filename, callback=None, destdir=None, retry=1):
- if destdir is None:
- destdir = self.getTempPath()
- fn = destdir + '/' + os.path.basename(filename)
-
- self.switchMedia(1, filename)
- try:
- shutil.copy(self.tree + '/' + filename, fn)
- except:
- fn = None
- return fn
-
- def switchMedia(self, mediano, filename=""):
- if mediano != self.mediaIsMounted:
- log.info("switching from iso %s to %s for %s" % (self.mediaIsMounted, mediano, filename))
- self.umountMedia()
- self.mountMedia(mediano)
-
- def systemMounted(self, fsset, mntPoint):
- self.switchMedia(1)
-
- def systemUnmounted(self):
- self.umountMedia()
-
- def filesDone(self):
- # we're trying to unmount the source image at the end. if it
- # fails, we'll reboot soon enough anyway
- try:
- self.umountMedia()
- except:
- log.warning("unable to unmount media")
-
- # we cannot remove the partition we are hosting hard drive install from
- def protectedPartitions(self):
- return [self.device]
-
- def __init__(self, rootPath, intf):
- """@param method hd://device:fstype:/path"""
- #method = method[5:]
- #device = method[0:method.index(":")]
- #tmpmethod = method[method.index(":") + 1:]
- #fstype = tmpmethod[0:tmpmethod.index("/")]
- #path = tmpmethod[tmpmethod.index("/") + 1:]
-
- ImageInstallMethod.__init__(self, rootPath, intf)
-
- self.device = device
- self.path = path
- self.fstype = fstype
- self.isoDirIsMounted = 0
- self.mediaIsMounted = 0
- self.messageWindow = intf.messageWindow
- self.currentMedia = []
- self.tree = "/tmp/isomedia/"
-
- # Mount the partition containing the ISO images just long enough for
- # us to build up a list of all the path names.
- self.mountDirectory()
- self.discImages = findIsoImages(self.isoDir + '/' + self.path, self.messageWindow)
- self.umountDirectory()
def __init__(self):
self.intf = None
self.id = None
- self.method = None
- self.methodstr = None
self.rootPath = HARDDISK_PATH
self.backend = None
def setBackend(self):
from pakfireinstall import PakfireBackend
- self.backend = PakfireBackend(self.method, self.rootPath)
+ self.backend = PakfireBackend(self.rootPath)
if __name__ == "__main__":
pomona = Pomona()
# reset python's default SIGINT handler
signal.signal(signal.SIGINT, signal.SIG_DFL)
- #pomona.setMethod(instClass)
-
- #pomona.setBackend(instClass)
+ pomona.setBackend()
pomona.id = instClass.installDataClass(pomona)
instClass.setInstallData(pomona)
import logging
log = logging.getLogger("pomona")
-class FileCopyException(Exception):
- def __init__(self, s=""):
- self.args = s
-
class InstallMethod:
def protectedPartitions(self):
return None
def getTempPath(self):
root = self.rootPath
- pathlist = [ "/var/tmp", "/tmp", "/." ]
+ pathlist = [ "/tmp", "/var/tmp", "/." ]
tmppath = None
for p in pathlist:
if (os.access(root + p, os.X_OK)):
# only use this if you really know what you're doing.
def postAction(self, pomona):
pass
-
-# This handles any cleanup needed for the method. It 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 command to do that
-# if the user wants.
-def doMethodComplete(pomona):
- pomona.method.filesDone()
-
- pomona.method.ejectMedia()
-
- mtab = "/dev/root / ext3 ro 0 0\n"
- for ent in pomona.id.fsset.entries:
- if ent.mountpoint == "/":
- mtab = "/dev/root / %s ro 0 0\n" %(ent.fsystem.name,)
-
- f = open(pomona.rootPath + "/etc/mtab", "w+")
- f.write(mtab)
- f.close()
self.users = users.Users()
# User should already exist, just without a password.
- self.users.setRootPassword(self.rootPassword["password"])
+ self.users.setRootPassword(self.rootPassword["password"], algo="sha512")
def __init__(self, pomona):
self.instLanguage = language.Language()
import locale
import signal
import subprocess
+import time
import urlgrabber.progress
import urlgrabber.grabber
from urlgrabber.grabber import URLGrabber, URLGrabError
-from installmethod import FileCopyException
from backend import PomonaBackend
from constants import *
from pyfire.translate import _
return _("%s Bytes") %(number_format(size),)
class PomonaCallback:
- def __init__(self, pomona, method):
- self.method = method
-
+ def __init__(self, pomona):
self.messageWindow = pomona.intf.messageWindow
self.waitWindow = pomona.intf.waitWindow
- self.progress = pomona.id.instProgress ### XXX what's this?
+ self.progress = pomona.id.instProgress
self.progressWindow = pomona.intf.progressWindow
self.initWindow = None
self.pomona = pomona
def run(self, cb, intf, id):
-
self.extractFiles(cb, intf, id)
- self.pomona.method.filesDone()
-
- def checkMd5(self):
- pass
-
def extractFiles(self, cb, intf, id):
filename = os.path.join(SOURCE_PATH, IMAGE_FILE)
filename_ls = os.path.join(SOURCE_PATH, IMAGE_FILE_LS)
cb.callback(CB_STOP)
class PakfireBackend(PomonaBackend):
- def __init__(self, method, instPath):
- PomonaBackend.__init__(self, method, instPath)
+ def __init__(self, instPath):
+ PomonaBackend.__init__(self, instPath)
def selectBestKernel(self):
"""Find the best kernel package which is available and select it."""
def doPreInstall(self, pomona):
if pomona.dir == DISPATCH_BACK:
- for d in ("/dev"): ### XXX proc, sys?
- try:
- isys.umount(pomona.rootPath + d, removeDir = 0)
- except Exception, e:
- log.error("unable to unmount %s: %s" %(d, e))
- return
-
- if self.method.systemMounted(pomona.id.fsset, pomona.rootPath):
- pomona.id.fsset.umountFilesystems(pomona.rootPath)
return DISPATCH_BACK
self.pompak = PomonaPakfire(pomona)
- pomona.method.doPreInstall(pomona)
-
def doInstall(self, pomona):
log.info("Preparing to install files")
- cb = PomonaCallback(pomona, self.method)
+ cb = PomonaCallback(pomona)
cb.initWindow = pomona.intf.waitWindow(_("Install Starting"),
_("Starting install process. This may take several minutes..."))
+ time.sleep(2)
self.pompak.run(cb, pomona.intf, pomona.id)
else:
return 1
-def hasProtectedPartitions(drive, pomona):
- rc = False
- if pomona is None:
- return rc
-
- try:
- for protected in pomona.method.protectedPartitions():
- if protected.startswith(drive):
- part = protected[len(drive):]
- if part[0] == "p":
- part = part[1:]
- if part.isdigit():
- rc = True
- break
- except:
- pass
-
- return rc
-
# attempt to associate a parted filesystem type on a partition that
# didn't probe as one type or another.
def validateFsType(part):
elif (part.fs_type and part.fs_type.name in fsset.getUsableLinuxFs()):
node = get_partition_name(part)
- # In hard drive ISO method, don't try to mount the
- # protected partitions because that'll throw up a
- # useless error message.
- protected = self.pomona.method.protectedPartitions()
-
- if protected and node in protected:
- part = disk.next_partition(part)
- continue
-
try:
isys.mount(node, self.pomona.rootPath, part.fs_type.name)
except SystemError, (errno, msg):
def partitionObjectsInitialize(pomona):
# read in drive info
pomona.id.diskset.refreshDevices()
-
pomona.id.partitions.setFromDisk(pomona.id.diskset)
- pomona.id.partitions.setProtected(pomona.dispatch)
def partitioningComplete(pomona):
if pomona.dir == DISPATCH_BACK and pomona.id.fsset.isActive():
return (errors, warnings)
- def setProtected(self, dispatch):
- """Set any partitions which should be protected to be so."""
- pass
- #protected = dispatch.method.protectedPartitions()
- #if protected:
- # for device in protected:
- # log.info("%s is a protected partition" % (device))
- # request = self.getRequestByDeviceName(device)
- # if request is not None:
- # request.setProtected(1)
- # else:
- # log.info("no request, probably a removable drive")
-
def copy(self):
"""Deep copy the object."""
new = Partitions()
"install" : ("tui_progress", "setupForInstall"),
"keyboard" : ("tui_keyboard", "KeyboardWindow"),
"language" : ("tui_language", "LanguageWindow"),
- "source" : ("tui_source", "SourceTypeWindow"),
"partition": ("tui_partition", ("PartitionWindow")),
"parttype" : ("tui_partition", "PartitionTypeWindow"),
"timezone" : ("tui_timezone", "TimezoneWindow"),
+++ /dev/null
-import isys
-from constants import *
-
-from snack import *
-
-from pyfire.translate import _, N_
-
-from urlparse import urlparse, urlunparse, urljoin
-
-class SourceTypeWindow:
- def __call__(self, screen, pomona):
- self.pomona = pomona
-
- ## If we go backwards we umount
- # our currently mounted media
- # and reset the method
- if pomona.dir == DISPATCH_BACK:
- pomona.method.umountMedia()
- pomona.method = None
-
- while 1:
- g = GridFormHelp(screen, _("Source Type"), "source", 1, 6)
-
- txt = TextboxReflowed(65, _("In installation you have to choose "
- "a source for the installation files. "
- "Mostly you will choose the disc here, "
- "but you are also able to install by "
- "HTTP, FTP hard disk or usb-key."))
- g.add(txt, 0, 0, (0, 0, 0, 0))
-
- options = ((_("Install Disc"), SOURCE_CDROM),
- (_("Internet Source"), SOURCE_URL),
- (_("External Drive"), SOURCE_HD))
-
- typebox = Listbox(height = len(options), scroll = 0)
- for (txt, val) in options:
- typebox.append(_("%s") % txt, val)
-
- typebox.setCurrent(SOURCE_CDROM)
-
- g.add(typebox, 0, 1, (0, 1, 0, 0))
-
- bb = ButtonBar(screen, [ TEXT_OK_BUTTON, TEXT_BACK_BUTTON ])
- g.add(bb, 0, 5, (0,1,0,0))
-
- rc = g.run()
-
- source_type = typebox.current()
- res = bb.buttonPressed(rc)
-
- screen.popHelpLine()
- screen.popWindow()
-
- if res == TEXT_BACK_CHECK:
- return INSTALL_BACK
-
- if source_type == SOURCE_CDROM:
- if not isys.cdromList():
- ButtonChoiceWindow(screen, _("No CDROM found"),
- _("You choosed to install from an installtion disc, "
- "but there was no cdrom drive found on the system. "
- "Please choose another installation method."),
- buttons = [ TEXT_OK_BUTTON ], width = 50)
- continue
-
- from image import CdromInstallMethod
- pomona.method = CdromInstallMethod(pomona.rootPath, pomona.intf)
- break
- elif source_type == SOURCE_URL:
- from urlinstall import UrlInstallMethod
- url = self.geturl(screen, pomona)
- pomona.method = UrlInstallMethod(url, pomona.rootPath, pomona.intf)
- break
- elif source_type == SOURCE_HD:
- from harddrive import HardDriveInstallMethod
- pomona.method = HardDriveInstallMethod(pomona.rootPath, pomona.intf)
- break
-
- pomona.setBackend()
-
- return INSTALL_OK
-
- def geturl(self, screen, pomona):
- toplevel = GridFormHelp(screen, _("Source URL"), "sourceurl", 1, 3)
-
- toplevel.add(TextboxReflowed(37, _("Enter a host you get the files from."
- "You also must enter a path where the "
- "installer finds the files in."))
- , 0, 0, (0, 0, 0, 1))
-
- host = Entry(24, text = URL_HOST)
- path = Entry(24, text = URL_PATH)
- urlgrid = Grid(2, 2)
- urlgrid.setField(Label(_("Host:")), 0, 0, (0, 0, 1, 0), anchorLeft = 1)
- urlgrid.setField(Label(_("Path:")), 0, 1, (0, 0, 1, 0), anchorLeft = 1)
- urlgrid.setField(host, 1, 0)
- urlgrid.setField(path, 1, 1)
- toplevel.add(urlgrid, 0, 1, (0, 0, 0, 1))
-
- bb = ButtonBar(screen, (TEXT_OK_BUTTON, TEXT_BACK_BUTTON))
- toplevel.add(bb, 0, 2, growx = 1)
-
- while 1:
- toplevel.setCurrent(host)
- result = toplevel.run()
- rc = bb.buttonPressed(result)
- if rc == TEXT_BACK_CHECK:
- screen.popWindow()
- return None
-
- ### Build the URL
- url = urlparse(urljoin(host.value(), path.value()))
-
- if url.scheme not in ("http", "ftp"):
- ButtonChoiceWindow(screen, _("Wrong Protocol"),
- _("You entered a protocol that is not supported by Pomona. "
- "There are only http:// and ftp:// available."),
- buttons = [ TEXT_OK_BUTTON ], width = 50)
- elif not url.path.endswith("/"):
- ButtonChoiceWindow(screen, _("Syntax Error"),
- _("The path of the URL must end with a /."),
- buttons = [ TEXT_OK_BUTTON ], width = 50)
- else:
- from urlinstall import urlretrieve
- testurl = urljoin(urlunparse(url), INFO_FILE)
- try:
- urlretrieve(testurl, "/tmp/" + INFO_FILE)
- except IOError, e:
- ButtonChoiceWindow(screen, _("Error"),
- _("When we tested your given URL there was an error.\n\n%s" % (e,)),
- buttons = [ TEXT_OK_BUTTON ], width = 50)
- continue
- break
-
- screen.popWindow()
-
- return urlunparse(url)
+++ /dev/null
-#
-# urlinstall.py - URL based install source method
-#
-# Erik Troan <ewt@redhat.com>
-#
-# Copyright 1999-2006 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.
-#
-
-from installmethod import InstallMethod, FileCopyException
-import os
-import re
-import time
-import shutil
-import string
-import socket
-import urlparse
-import urlgrabber.grabber as grabber
-import isys
-from pakfireinstall import PomonaCallback
-
-from snack import *
-from constants import *
-
-from pyfire.translate import _
-
-import logging
-log = logging.getLogger("pomona")
-
-def urlretrieve(location, file, callback=None):
- """Downloads from location and saves to file."""
- if callback is not None:
- callback.initWindow = \
- callback.waitWindow(_("Downloading"), _("Connecting..."))
-
- log.info("Retrieving url %s" % location)
-
- try:
- url = grabber.urlopen(location)
- except grabber.URLGrabError, e:
- raise IOError(e.errno, e.strerror)
-
- # see if there is a size
- try:
- filesize = int(url.info()["Content-Length"])
- if filesize == 0:
- filesize = None
- except:
- filesize = None
-
- if callback is not None:
- if not filesize:
- callback.setSize(0)
- else:
- callback.setSize(filesize)
-
- # create output file
- f = open(file, 'w+')
-
- if callback is not None:
- callback.callback(CB_START, title=_("Downloading"), text=_("Retrieving %s")
- % os.path.basename(urlparse.urlparse(location).path))
-
- # if they dont want a status callback just do it in one big swoop
- if callback is None:
- f.write(url.read())
- else:
- buf = url.read(65535)
- tot = len(buf)
- while len(buf) > 0:
- if filesize is not None:
- callback.callback(CB_PROGRESS, amount=tot)
- else:
- callback.callback(CB_PROGRESS, amount="%dKB..." % (tot/1024,))
- f.write(buf)
- buf = url.read(65535)
- tot += len(buf)
-
- f.close()
- url.close()
- if callback is not None:
- callback.callback(CB_STOP)
-
-class UrlInstallMethod(InstallMethod):
- def badPackageError(self, pkgname):
- return _("The file %s cannot be opened. This is due to a missing "
- "file or perhaps a corrupt package. Please verify your "
- "mirror contains all required packages, and try using a "
- "different one.\n\n"
- "If you reboot, your system will be left in an inconsistent "
- "state that will likely require reinstallation.\n\n") % pkgname
-
- def getFilename(self, filename, callback=None, destdir=None, retry=1):
- if destdir is None:
- tmppath = self.getTempPath()
- else:
- tmppath = destdir
-
- fullPath = urlparse.urljoin(self.url, filename)
-
- file = tmppath + "/" + os.path.basename(fullPath)
-
- tries = 0
- while tries < 5:
- try:
- rc=urlretrieve(fullPath, file, callback=callback)
- except IOError, (errnum, msg):
- log.critical("IOError %s occurred getting %s: %s"
- % (errnum, fullPath.replace("%", "%%"), str(msg)))
-
- if not retry:
- raise FileCopyException
-
- time.sleep(5)
- else:
- break
-
- tries = tries + 1
-
- if tries >= 5:
- raise FileCopyException
-
- return file
-
- def __copyFileToTemp(self, baseurl, filename, raise404=False):
- tmppath = self.getTempPath()
-
- fullPath = baseurl + "/" + filename
-
- file = tmppath + "/" + os.path.basename(fullPath)
-
- tries = 0
- while tries < 5:
- try:
- urlretrieve(fullPath, file)
- except IOError, (errnum, msg):
- if errnum == 14 and "404" in msg and raise404:
- raise
- log.critical("IOError %s occurred getting %s: %s",
- errnum, fullPath.replace("%", "%%"), str(msg))
- time.sleep(5)
- else:
- break
- tries = tries + 1
-
- if tries >= 5:
- raise FileCopyException
- return file
-
- def copyFileToTemp(self, filename):
- return self.__copyFileToTemp(self.pkgUrl, filename)
-
- def unlinkFilename(self, fullName):
- os.remove(fullName)
-
- def setIntf(self, intf):
- self.intf = intf
- self.messageWindow = intf.messageWindow
- self.progressWindow = intf.progressWindow
-
- def getMethodUri(self):
- return self.baseUrl
-
- def unmountMedia(self):
- if not self.tree:
- return
-
- while True:
- try:
- isys.umount("/mnt/source")
- break
- except Exception, e:
- log.error("exception in unmountCD: %s" %(e,))
- self.messageWindow(_("Error"),
- _("An error occurred unmounting the disc. "
- "Please make sure you're not accessing "
- "%s from the shell on tty2 "
- "and then click OK to retry.")
- % ("/mnt/source",))
-
- def filesDone(self):
- for file in REQUIRED_FILES:
- try:
- os.unlink("%s/%s" % (SOURCE_PATH, file,))
- except Exception, e:
- log.error("Cannot remove %s/%s: %s" % (SOURCE_PATH, file, e,))
-
- def __init__(self, url, rootPath, intf):
- InstallMethod.__init__(self, rootPath, intf)
-
- self.url = url
- log.info("Got base url: %s" % (self.url,))
-
- (scheme, netloc, path, query, fragid) = urlparse.urlsplit(self.url)
-
- try:
- socket.inet_pton(socket.AF_INET6, netloc)
- netloc = '[' + netloc + ']'
- except:
- pass
-
- # encoding fun so that we can handle absolute paths
- if scheme == "ftp" and path and path.startswith("//"):
- path = "/%2F" + path[1:]
-
- self.messageWindow = intf.messageWindow
- self.progressWindow = intf.progressWindow
- self.waitWindow = intf.waitWindow
-
- def doPreInstall(self, pomona):
- cb = PomonaCallback(pomona, pomona.method)
-
- for file in REQUIRED_FILES:
- self.getFilename(file, destdir=SOURCE_PATH, callback=cb)
-
- def doPostInstall(self, pomona):
- pass