We now do create the initramfs after extraction.
This looks just nicer...
Additionally I reformated the code a little bit
and removed unused parts.
f.write('# root %s\n' % self.grubbyPartitionName(bootDevs[0]))
f.write("# kernel %svmlinuz-version ro "
"root=/dev/%s\n" % (cfPath, rootDev))
- f.write("# initrd %sinitrd-version.img\n" % (cfPath))
+ f.write("# initrd %sinitramfs-version.img\n" % (cfPath))
f.write("#boot=/dev/%s\n" % (grubTarget))
# keep track of which devices are used for the device.map
for (kernelName, kernelVersion, kernelTag, kernelDesc) in kernelList:
kernelFile = "%s%skernel%s" % (cfPath, sname, kernelTag,)
- initrd = "/boot/initrd-%s%s.img" % (kernelVersion, kernelTag,)
-
- # make initramfs
- pyfire.executil.execWithRedirect("/sbin/mkinitramfs",
- ["/sbin/mkinitramfs", "-v", "-f", "%s" % initrd,
- "%s%s" % (kernelVersion, kernelTag,), ],
- stdout = "/dev/tty5", stderr = "/dev/tty5",
- root = instRoot)
+ initrd = "/boot/initramfs-%s%s.img" % (kernelVersion, kernelTag,)
f.write('title %s (%s - %s)\n' % (name, kernelDesc, kernelVersion))
f.write('\troot %s\n' % self.grubbyPartitionName(bootDevs[0]))
f.write('\n')
if os.access (instRoot + initrd, os.R_OK):
- f.write('\tinitrd %sinitrd-%s%s.img\n' % (cfPath, kernelVersion, kernelTag,))
+ # initrd is built in backend.postInstall
+ f.write('\tinitrd %sinitramfs-%s%s.img\n' % (cfPath, kernelVersion, kernelTag,))
for (label, longlabel, device) in chainList:
if ((not longlabel) or (longlabel == "")):
while trace.tb_next:
trace = trace.tb_next
frame = trace.tb_frame
- out.write ("\nLocal variables in innermost frame:\n")
+ out.write("\nLocal variables in innermost frame:\n")
try:
for (key, value) in frame.f_locals.items():
- out.write ("%s: %s\n" % (key, value))
+ out.write("%s: %s\n" % (key, value))
except:
pass
out.write("\nException occurred during %s file copy:\n" % (file,))
traceback.print_exc(None, out)
-# Returns 0 on success, 1 on cancel, 2 on error.
-def copyExceptionToRemote(intf):
- import pty
-
- scpWin = intf.scpWindow()
- while 1:
- # Bail if they hit the cancel button.
- scpWin.run()
- scpInfo = scpWin.getrc()
-
- if scpInfo == None:
- scpWin.pop()
- return 1
-
- (host, path, user, password) = scpInfo
-
- if host.find(":") != -1:
- (host, port) = host.split(":")
-
- # Try to convert the port to an integer just as a check to see
- # if it's a valid port number. If not, they'll get a chance to
- # correct the information when scp fails.
- try:
- int(port)
- portArgs = ["-P", port]
- except ValueError:
- portArgs = []
- else:
- portArgs = []
-
- # Thanks to Will Woods <wwoods@redhat.com> for the scp control
- # here and in scpAuthenticate.
-
- # Fork ssh into its own pty
- (childpid, master) = pty.fork()
- if childpid < 0:
- log.critical("Could not fork process to run scp")
- scpWin.pop()
- return 2
- elif childpid == 0:
- # child process - run scp
- args = ["scp", "-oNumberOfPasswordPrompts=1",
- "-oStrictHostKeyChecking=no"] + portArgs + \
- ["/tmp/anacdump.txt", "%s@%s:%s" % (user, host, path)]
- os.execvp("scp", args)
-
- # parent process
- try:
- childstatus = scpAuthenticate(master, childpid, password)
- except OSError:
- scpWin.pop()
- return 2
-
- os.close(master)
-
- if os.WIFEXITED(childstatus) and os.WEXITSTATUS(childstatus) == 0:
- return 0
- else:
- scpWin.pop()
- return 2
-
-def scpAuthenticate(master, childpid, password):
- while 1:
- # Read up to password prompt. Propagate OSError exceptions, which
- # can occur for anything that causes scp to immediately die (bad
- # hostname, host down, etc.)
- buf = os.read(master, 4096)
- if buf.find("'s password: ") != -1:
- os.write(master, password+"\n")
- # read the space and newline that get echoed back
- os.read(master, 2)
- break
-
- while 1:
- buf = ""
- try:
- buf = os.read(master, 4096)
- except (OSError, EOFError):
- break
-
- (pid, childstatus) = os.waitpid (childpid, 0)
- return childstatus
-
# Reverse the order that tracebacks are printed so people will hopefully quit
# giving us the least useful part of the exception in bug reports.
-def formatException (type, value, tb):
+def formatException(type, value, tb):
lst = traceback.format_tb(tb)
lst.reverse()
lst.insert(0, 'Traceback (most recent call first):\n')
sys.excepthook = sys.__excepthook__
# get traceback information
- list = formatException (type, value, tb)
- text = joinfields (list, "")
+ list = formatException(type, value, tb)
+ text = joinfields(list, "")
# save to local storage first
out = open("/tmp/instdump.txt", "w")
- dumpException (out, text, tb, pomona)
+ dumpException(out, text, tb, pomona)
out.close()
win = pomona.intf.exceptionWindow(text, "/tmp/instdump.txt")
rc = win.getrc()
if rc == 0:
- pomona.intf.__del__ ()
+ pomona.intf.__del__()
os.kill(os.getpid(), signal.SIGKILL)
- elif rc == 1:
- scpRc = copyExceptionToRemote(pomona.intf)
-
- if scpRc == 0:
- pomona.intf.messageWindow(_("Dump Written"),
- _("Your system's state has been successfully written to "
- "the remote host. Your system will now be rebooted."),
- type="custom", custom_icon="info",
- custom_buttons=[_("_Reboot")])
- sys.exit(0)
- elif scpRc == 1:
- continue
- elif scpRc == 2:
- pomona.intf.messageWindow(_("Dump Not Written"),
- _("There was a problem writing the system state to the "
- "remote host."))
- continue
self.migratetofs = None
self.extraFormatArgs = []
self.maxLabelChars = 16
- self.packages = []
def isKernelFS(self):
"""Returns True if this is an in-kernel pseudo-filesystem."""
self.linuxnativefs = 1
self.supported = -1
self.name = "reiserfs"
- self.packages = [ "reiserfs-utils" ] ### XXX do we need this?
self.maxSizeMB = 8 * 1024 * 1024
self.maxSizeMB = 16 * 1024 * 1024
self.maxLabelChars = 12
self.supported = -1
- self.packages = [ "xfsprogs" ] ### XXX do we need this?
def formatDevice(self, entry, progress, chroot='/'):
devicePath = entry.device.setupDevice(chroot)
self.checked = 1
self.linuxnativefs = 1
self.maxSizeMB = 8 * 1024 * 1024
- self.packages = [ "e2fsprogs" ] ### XXX do we need this?
def labelDevice(self, entry, chroot):
devicePath = entry.device.setupDevice(chroot)
% (devicePath, devicePath), type = "yesno")
if rc == 0:
sys.exit(0)
- entry.fsystem = entry.origfsystem ### XXX what is this?
- else:
- extFileSystem.setExt3Options(self, entry, message, chroot)
+ entry.fsystem = entry.origfsystem ### XXX what is this?
+ else:
+ extFileSystem.setExt3Options(self, entry, message, chroot)
fileSystemTypeRegister(ext2FileSystem())
def __init__(self):
FileSystemType.__init__(self)
self.partedFileSystemType = parted.file_system_type_get("fat32")
- self.formattable = 1
+ self.formattable = 0
self.checked = 0
self.maxSizeMB = 1024 * 1024
self.name = "vfat"
- self.packages = [ "dosfstools" ]
-
- def formatDevice(self, entry, progress, chroot='/'):
- devicePath = entry.device.setupDevice(chroot)
- devArgs = self.getDeviceArgs(entry.device)
- args = [ devicePath ]
- args.extend(devArgs)
-
- rc = inutil.execWithRedirect("mkdosfs", args,
- stdout = "/dev/tty5",
- stderr = "/dev/tty5", searchPath = 1)
- if rc:
- raise SystemError
fileSystemTypeRegister(FATFileSystem())
if not self.isMountable():
return
inutil.mkdirChain("%s/%s" %(instroot, mountpoint))
- if flags.selinux:
- ret = isys.resetFileContext(mountpoint, instroot)
- log.info("set SELinux context for mountpoint %s to %s" %(mountpoint, ret))
-
for fs in getFStoTry (device):
try:
isys.mount (device, mountpoint, fstype = fs, readOnly = readOnly,
pdb.set_trace()
log.info (_("Starting text installation..."))
- import instdata
- from tui import InstallInterface
- from exception import handleException
- import warnings, signal
instClass = getInstClass()
checkMemory()
+ from tui import InstallInterface
pomona.intf = InstallInterface()
+ import warnings, signal
warnings.showwarning = PomonaShowWarning
# reset python's default SIGINT handler
# anaconda.dispatch.skipStep("keyboard", permanent = 1)
# instClass.setKeyboard(anaconda.id, opts.keymap)
+ from exception import handleException
sys.excepthook = lambda type, value, tb, pomona=pomona: handleException(pomona, (type, value, tb))
try:
import inutil
import isys
+import pyfire
def size_string(size):
def number_format(s):
# installer /dev
isys.mount("/dev", "%s/dev" %(pomona.rootPath,), bindMount = 1)
- PomonaBackend.doPostInstall(self, pomona)
- w.pop()
-
- ### XXX this is from pre
# write out the fstab
pomona.id.fsset.write(pomona.rootPath)
# rootpath mode doesn't have this file around
if os.access("/tmp/modprobe.conf", os.R_OK):
shutil.copyfile("/tmp/modprobe.conf",
pomona.rootPath + "/etc/modprobe.conf")
+
### XXX pomona.id.network.write(pomona.rootPath)
+ for (kernelName, kernelVersion, kernelTag, kernelDesc) in self.kernelVersionList(pomona):
+ initrd = "/boot/initramfs-%s%s.img" % (kernelVersion, kernelTag,)
+ log.info("mkinitramfs: creating %s" % initrd)
+ pyfire.executil.execWithRedirect("/sbin/mkinitramfs",
+ ["/sbin/mkinitramfs", "-v", "-f", "%s" % initrd,
+ "%s%s" % (kernelVersion, kernelTag,), ],
+ stdout = "/dev/tty5", stderr = "/dev/tty5",
+ root = pomona.rootPath)
+
+ PomonaBackend.doPostInstall(self, pomona)
+ w.pop()
+
def kernelVersionList(self, pomona):
kernelVersions = []