From 8e7a9bc91b98a02e41dd6d53e8a2027c482346a8 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 19 Apr 2002 06:28:35 +0000 Subject: more merging fun from the hampton branch. I'm pretty sure this doesn't work now, at least in gui. text mode might, though --- Makefile | 7 +- anaconda | 28 +++--- anaconda.spec.in | 6 ++ autopart.py | 26 +++-- constants.py | 4 + dispatch.py | 2 +- exception.py | 4 +- floppy.py | 8 +- gui.py | 19 ++-- image.py | 8 +- instdata.py | 2 +- iutil.py | 6 +- kbd.py | 3 +- kickstart.py | 19 +++- lang-table | 7 +- language.py | 3 + mouse.py | 5 +- network.py | 2 +- packages.py | 47 +++++++-- product.py.in | 13 +++ rescue.py | 71 ++++++++----- scripts/genlocalelist | 20 ++-- scripts/mk-images | 9 ++ scripts/mk-images.i386 | 17 ++++ scripts/pkgorder | 3 + scripts/splitdistro | 14 ++- scripts/upd-instroot | 14 ++- text.py | 6 +- textw/bootdisk_text.py | 4 +- textw/bootloader_text.py | 4 +- textw/complete_text.py | 11 +- textw/confirm_text.py | 4 +- textw/constants_text.py | 27 +++-- textw/firewall_text.py | 5 +- textw/keyboard_text.py | 3 + textw/upgrade_text.py | 12 ++- textw/welcome_text.py | 12 ++- textw/xconfig_text.py | 16 ++- upgrade.py | 62 +++++++++++- utils/Makefile | 12 +++ utils/checkisomd5.c | 184 ++++++++++++++++++++++++++++++++++ utils/implantisomd5.c | 182 +++++++++++++++++++++++++++++++++ utils/md5.c | 256 +++++++++++++++++++++++++++++++++++++++++++++++ utils/md5.h | 25 +++++ whiteout.py | 29 ++++++ 45 files changed, 1090 insertions(+), 131 deletions(-) create mode 100644 product.py.in create mode 100644 utils/checkisomd5.c create mode 100644 utils/implantisomd5.c create mode 100644 utils/md5.c create mode 100644 utils/md5.h create mode 100644 whiteout.py diff --git a/Makefile b/Makefile index 8da89c4b1..e4da8f559 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ include Makefile.inc -VERSION = 7.2.91 +VERSION = 7.3.90 RELEASE = 0 SNAPRELEASE = $(RELEASE)$(shell date "+.%Y%m%d%H%M") @@ -21,7 +21,10 @@ CATALOGS = po/anaconda.pot PYFILES = $(wildcard *.py) -all: subdirs _xkb.so xmouse.so $(CATALOGS) lang-table lang-names +all: subdirs _xkb.so xmouse.so $(CATALOGS) lang-table lang-names product.py + +product.py: product.py.in Makefile.inc + sed -e 's/@@PRODUCTNAME@@/$(PRODUCTNAME)/g' < product.py.in > product.py lang-names: lang-table PYTHONPATH="iconvmodule:." $(PYTHON) scripts/getlangnames.py > lang-names diff --git a/anaconda b/anaconda index a2092de9c..69d2ad7d2 100755 --- a/anaconda +++ b/anaconda @@ -93,7 +93,7 @@ try: 'testpath=', 'mountfs', 'traceonly', 'kickstart=', 'lang=', 'keymap=', 'module=', 'class=', 'expert', 'serial', 'lowres', 'nofb', 'rescue', 'nomount', - 'autostep']) + 'autostep', 'resolution=']) except TypeError, msg: sys.stderr.write("Error %s\n:" % msg) sys.exit(-1) @@ -191,6 +191,10 @@ for n in args: overhead = int(arg) elif (str == '--rescue'): progmode = 'rescue' + elif (str == '--resolution'): + # run native X server at specified resolution, ignore fb + runres = arg + nofb = 1 elif (str == "--autostep"): flags.autostep = 1 elif (str == '-r' or str == '--rootpath'): @@ -244,12 +248,13 @@ if (debug): import pdb pdb.set_trace() -# don't let folks do anything stupid on !s390 -if (not flags.test and os.getpid() > 90 and flags.setupFilesystems and - not iutil.getArch() == "s390"): - sys.stderr.write( - "You're running me on a live system! that's incredibly stupid.\n") - sys.exit(1) +# let people be stupid +## # don't let folks do anything stupid on !s390 +## if (not flags.test and os.getpid() > 90 and flags.setupFilesystems and +## not iutil.getArch() == "s390"): +## sys.stderr.write( +## "You're running me on a live system! that's incredibly stupid.\n") +## sys.exit(1) import isys import instdata @@ -281,6 +286,7 @@ if traceOnly: import xserver import configFileData import kickstart + import whiteout installclass.availableClasses() @@ -397,7 +403,8 @@ if 1: if (display_mode != 't' and method and method.startswith('ftp://') or method.startswith('http://') or - method.startswith('hd://')): + method.startswith('hd://') or + method.startswith('oldhd://')): print _("Graphical installation not available for %s installs. " "Starting text mode.") % (string.split(method, ':')[0],) display_mode = 't' @@ -429,7 +436,6 @@ else: # s390 checks # startXServer = 0 - if display_mode == 'g': import xf86config @@ -588,10 +594,6 @@ if method: floppyDevice = floppy.probeFloppyDevice() -# create device nodes for detected devices if we're not running in test mode -if not flags.test and flags.setupFilesystems: - iutil.makeDriveDeviceNodes() - id = instClass.installDataClass(extraModules, floppyDevice, configFileData) #id = instClass.installDataClass(extraModules, floppyDevice) diff --git a/anaconda.spec.in b/anaconda.spec.in index c520a7a6e..e58bd4915 100644 --- a/anaconda.spec.in +++ b/anaconda.spec.in @@ -51,6 +51,9 @@ rm -rf $RPM_BUILD_ROOT %doc COPYING %doc docs/command-line.txt %doc docs/install-methods.txt +%doc docs/kickstart-docs.txt +%doc docs/kickstart-docs.html +%doc docs/anaconda-release-notes.txt /usr/sbin/anaconda /usr/share/anaconda /usr/share/locale/*/*/* @@ -66,6 +69,9 @@ rm -rf $RPM_BUILD_ROOT * %{date} Anaconda team - built new version from CVS +* Tue Apr 02 2002 Michael Fulbright +- added some more docs + * Fri Feb 22 2002 Jeremy Katz - buildrequire kernel-pcmcia-cs as we've sucked the libs the loader needs to there now diff --git a/autopart.py b/autopart.py index 10f6e72d3..d058374e4 100644 --- a/autopart.py +++ b/autopart.py @@ -24,6 +24,7 @@ import partRequests from constants import * from translate import _, N_ from partErrors import * +from log import log PARTITION_FAIL = -1 PARTITION_SUCCESS = 0 @@ -262,7 +263,7 @@ def fitSized(diskset, requests, primOnly = 0, newParts = None): largestPart = (0, None) drives = getDriveList(request, diskset) -# print "Trying drives to find best free space out of", free +# log("Trying drives to find best free space out of", free) for drive in drives: # this request is bootable and we've found a large enough # partition already, so we don't need to keep trying other @@ -271,11 +272,24 @@ def fitSized(diskset, requests, primOnly = 0, newParts = None): break # print "Trying drive", drive disk = diskset.disks[drive] + numPrimary = len(partedUtils.get_primary_partitions(disk)) + + # if there is an extended partition add it in + if disk.extended_partition: + numPrimary = numPrimary + 1 + + maxPrimary = disk.max_primary_partition_count for part in free[drive]: -# print "Trying partition", printFreespaceitem(part) + # if this is a free space outside extended partition + # make sure we have free primary partition slots + if not part.type & parted.PARTITION_LOGICAL: + if numPrimary == maxPrimary: + continue + +# log( "Trying partition %s" % (printFreespaceitem(part),)) partSize = partedUtils.getPartSizeMB(part) -# print "partSize %s request %s" % (partSize, request.requestSize) +# log("partSize %s request %s" % (partSize, request.requestSize)) if partSize >= request.requestSize and partSize > largestPart[0]: if not request.primary or (not part.type & parted.PARTITION_LOGICAL): largestPart = (partSize, part) @@ -286,7 +300,7 @@ def fitSized(diskset, requests, primOnly = 0, newParts = None): return PARTITION_FAIL # raise PartitioningError, "Can't fulfill request for partition: \n%s" %(request) -# print "largestPart is",largestPart +# log( "largestPart is %s" % (largestPart,)) freespace = largestPart[1] freeStartSec = freespace.geom.start freeEndSec = freespace.geom.end @@ -348,7 +362,7 @@ def fitSized(diskset, requests, primOnly = 0, newParts = None): raise PartitioningError, "Impossible partition to create" fsType = request.fstype.getPartedFileSystemType() -# print "creating newp with start=%s, end=%s, len=%s" % (startSec, endSec, endSec - startSec) +# log("creating newp with start=%s, end=%s, len=%s" % (startSec, endSec, endSec - startSec)) newp = disk.partition_new (partType, fsType, startSec, endSec) constraint = disk.constraint_any () @@ -754,7 +768,6 @@ def doPartitioning(diskset, requests, doRefresh = 1): if ret == PARTITION_FAIL: raise PartitioningError, "Partitioning failed: %s" %(msg) - ret = growParts(diskset, requests, newParts) newParts.reset() @@ -894,7 +907,6 @@ def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch): # XXX only do this if we're dirty ## id.diskset.refreshDevices() ## id.partrequests = PartitionRequests(id.diskset) - doClearPartAction(partitions, diskset) # XXX clearpartdrives is overloaded as drives we want to use for linux diff --git a/constants.py b/constants.py index d527cb630..0fb4591be 100644 --- a/constants.py +++ b/constants.py @@ -41,3 +41,7 @@ CLEARPART_TYPE_NONE = 3 CHECK_DEPS = 0 IGNORE_DEPS = 1 RESOLVE_DEPS = 2 + +# common string needs to be easy to change +import product +productName = product.productName diff --git a/dispatch.py b/dispatch.py index 23b2ff9b7..07cf3861e 100644 --- a/dispatch.py +++ b/dispatch.py @@ -121,7 +121,7 @@ installSteps = [ ("dopostaction", doPostAction, ("id", "instPath")), ("bootdisk", ("dir", "dispatch", "id.fsset")), ("makebootdisk", makeBootdisk, ("intf", "id.floppyDevice", - "id.hdList", "instPath")), + "id.hdList", "instPath", "id.bootloader")), ("videocard", ("dispatch", "id.xconfig", "id.videocard", "intf")), ("monitor", ("id.xconfig", "id.monitor")), ("xcustom", ("id.xconfig", "id.monitor", "id.videocard", diff --git a/exception.py b/exception.py index a787ce331..083464b2d 100644 --- a/exception.py +++ b/exception.py @@ -143,8 +143,8 @@ def dumpException(out, text, tb, dispatch): traceback.print_exc(None, out) for file in ("/tmp/syslog", "/tmp/netinfo", - dispatch.instPath + "/tmp/install.log", - dispatch.instPath + "/tmp/upgrade.log"): + dispatch.instPath + "/root/install.log", + dispatch.instPath + "/root/upgrade.log"): try: f = open(file, 'r') line = "\n\n%s:\n" % (file,) diff --git a/floppy.py b/floppy.py index 9a6f7af14..6980dd3ed 100644 --- a/floppy.py +++ b/floppy.py @@ -48,7 +48,7 @@ def probeFloppyDevice(): log("anaconda floppy device is %s", fdDevice) return fdDevice -def makeBootdisk (intf, floppyDevice, hdList, instPath): +def makeBootdisk (intf, floppyDevice, hdList, instPath, bootloader): if flags.test: return DISPATCH_NOOP @@ -70,9 +70,15 @@ def makeBootdisk (intf, floppyDevice, hdList, instPath): kernelTag = "-%s-%s" % (kernel[rpm.RPMTAG_VERSION], kernel[rpm.RPMTAG_RELEASE]) + if bootloader.args.get(): + args = bootloader.args.get() + else: + args = "" + w = intf.waitWindow (_("Creating"), _("Creating boot disk...")) rc = iutil.execWithRedirect("/sbin/mkbootdisk", [ "/sbin/mkbootdisk", + "--kernelargs", args, "--noprompt", "--device", "/dev/" + floppyDevice, diff --git a/gui.py b/gui.py index a44df515a..10d65804a 100755 --- a/gui.py +++ b/gui.py @@ -26,6 +26,7 @@ from language import expandLangs from splashscreen import splashScreenPop from log import log from flags import flags +from constants import * StayOnScreen = "stayOnScreen" mainWindow = None @@ -353,7 +354,8 @@ class InstallInterface: self.dispatch = dispatch - if flags.setupFilesystems: + # XXX users complain when the keypad doesn't work for input. + if 0 and flags.setupFilesystems: try: kb.setMouseKeys (1) except SystemError: @@ -525,14 +527,17 @@ class InstallControlWindow: def loadReleaseNotes(self): langList = self.langSearchPath + [ "" ] sourcepath = self.dispatch.method.getSourcePath() + suffixList = [] for lang in langList: if lang: - langpart = '.%s' % (lang,) + suffixList.append("-%s.html" % (lang,)) + suffixList.append(".%s" % (lang,)) else: - langpart = '' + suffixList.append(".html") + suffixList.append("") - for suffix in ('.html', ''): - fn = '%s/RELEASE-NOTES%s%s' % (sourcepath, langpart, suffix) + for suffix in suffixList: + fn = "%s/RELEASE-NOTES%s" % (sourcepath, suffix) if os.access(fn, os.R_OK): file = open(fn, "r") if suffix == '.html': @@ -752,7 +757,7 @@ class InstallControlWindow: self.window.set_border_width (10) - title = _("Red Hat Linux Installer") + title = _("%s Installer") % (productName,) if os.environ["DISPLAY"][:1] != ':': # from gnome.zvt import * # zvtwin = gtk.Window () @@ -767,7 +772,7 @@ class InstallControlWindow: for line in lines: netinf = string.splitfields (line, '=') if netinf[0] == "HOSTNAME": - title = _("Red Hat Linux Installer on %s") % string.strip (netinf[1]) + title = _("%s Installer on %s") % (productName, string.strip (netinf[1])) # shtitle = _("Red Hat Linux Install Shell on %s") % string.strip (netinf[1]) break diff --git a/image.py b/image.py index b34cfc284..8bf43b757 100644 --- a/image.py +++ b/image.py @@ -113,6 +113,9 @@ class CdromInstallMethod(ImageInstallMethod): if done: break + if done: + break + if not done: isys.ejectCdrom(self.device) @@ -133,6 +136,8 @@ class CdromInstallMethod(ImageInstallMethod): f.close() if newStamp == timestamp: done = 1 + # make /tmp/cdrom again so cd gets ejected + isys.makeDevInode(self.device, "/tmp/cdrom") if not done: self.messageWindow(_("Wrong CDROM"), @@ -174,8 +179,6 @@ def findIsoImages(path, messageWindow): arch = iutil.getArch() discImages = {} - print "need to look at", files - for file in files: what = path + '/' + file if not isys.isIsoImage(what): continue @@ -262,7 +265,6 @@ class NfsIsoInstallMethod(NfsInstallMethod): # images the same way -- we use loop3 for everything self.discImages = findIsoImages(tree, messageWindow) - print "found", self.discImages, "in tree", tree self.mountImage(1) ImageInstallMethod.__init__(self, self.mntPoint) diff --git a/instdata.py b/instdata.py index 83c46e23b..7553320ff 100644 --- a/instdata.py +++ b/instdata.py @@ -119,7 +119,7 @@ class InstallData: self.langSupport.writeKS(f) self.keyboard.writeKS(f) self.mouse.writeKS(f) - self.xconfig.writeKS(f) + self.xconfig.writeKS(f, self.desktop) self.network.writeKS(f) self.rootPassword.writeKS(f, self.auth) self.firewall.writeKS(f) diff --git a/iutil.py b/iutil.py index cedf2661b..b1c1cc3b8 100644 --- a/iutil.py +++ b/iutil.py @@ -298,7 +298,11 @@ def findtz(basepath, relpath): def rmrf (path): # this is only the very simple case. - files = os.listdir (path) + if os.path.isdir(path): + files = os.listdir (path) + else: + os.unlink(path) + return for file in files: if os.path.isdir(path + '/' + file): rmrf (path + '/' + file) diff --git a/kbd.py b/kbd.py index dbe341248..21cd42e1c 100644 --- a/kbd.py +++ b/kbd.py @@ -35,6 +35,7 @@ class Keyboard (SimpleConfigFile): ("dk" , ('pc102', 'dk', '')), ("dk-latin1" , ('pc102', 'dk', '')), ("es" , ('pc102', 'es', '')), + ("et" , ('pc105', 'ee', '')), ("fi" , ('pc102', 'fi', '')), ("fi-latin1" , ('pc102', 'fi', '')), ("fr" , ('pc102', 'fr', '')), @@ -92,7 +93,7 @@ class Keyboard (SimpleConfigFile): x2console = {} for (console, (map, layout, variant)) in console2xlist: - + if not x2console.has_key((map, layout, variant)): x2console [(map, layout, variant)] = console diff --git a/kickstart.py b/kickstart.py index 6d7abd7ff..012bf90b9 100644 --- a/kickstart.py +++ b/kickstart.py @@ -109,7 +109,7 @@ class KickstartBase(BaseInstallClass): trusts.append(arg) elif str == '--port': if ports: - ports = '%s %s' % (ports, arg) + ports = '%s,%s' % (ports, arg) else: ports = arg @@ -220,7 +220,8 @@ class KickstartBase(BaseInstallClass): def doBootloader (self, id, args, useLilo = 0): (args, extra) = isys.getopt(args, '', [ 'append=', 'location=', 'useLilo', 'lba32', - 'password=', 'md5pass=', 'linear', 'nolinear']) + 'password=', 'md5pass=', 'linear', 'nolinear', + 'upgrade']) validLocations = [ "mbr", "partition", "none" ] appendLine = "" @@ -229,6 +230,7 @@ class KickstartBase(BaseInstallClass): md5pass = None forceLBA = 0 linear = 1 + upgrade = 0 for n in args: (str, arg) = n @@ -248,6 +250,8 @@ class KickstartBase(BaseInstallClass): password = arg elif str == '--md5pass': md5pass = arg + elif str == '--upgrade': + upgrade = 1 if location not in validLocations: raise ValueError, "mbr, partition, or none expected for bootloader command" @@ -255,9 +259,19 @@ class KickstartBase(BaseInstallClass): location = None else: location = validLocations.index(location) + + # FIXME: upgrade mode not implemented yet on HEAD + if upgrade and not id.upgrade.get(): + raise RuntimeError, "Selected upgrade mode for bootloader but not doing an upgrade" + + if upgrade: + id.bootloader.kickstart = 1 + id.bootloader.doUpgradeOnly = 1 self.setBootloader(id, useLilo, location, linear, forceLBA, password, md5pass, appendLine) + # FIXME: uncomment when upgrade boot loader stuff is merged +# self.skipSteps.append("upgbootloader") self.skipSteps.append("bootloader") self.skipSteps.append("bootloaderadvanced") @@ -652,6 +666,7 @@ class KickstartBase(BaseInstallClass): raidDev = arg if raidDev[0:2] == "md": raidDev = raidDev[2:] + raidDev = int(raidDev) elif str == "--spares": spares = int(arg) elif str == "--noformat": diff --git a/lang-table b/lang-table index e6f11d7f0..f8d088adb 100644 --- a/lang-table +++ b/lang-table @@ -1,4 +1,6 @@ -Czech cs lat3-sun16 iso02 cs_CZ cz-lat2 Europe/Prague +Chinese(Simplified) zh_CN.GB18030 None None zh_CN.GB18030 us Asia/Shanghai +Chinese(Traditional) zh_TW.Big5 None None zh_TW.Big5 us Asia/Taipei +Czech cs lat2-sun16 iso02 cs_CZ cz-lat2 Europe/Prague Danish da lat0-sun16 iso15 da_DK us Europe/Copenhagen English en default8x16 iso01 en_US us America/New_York French fr lat0-sun16 iso15 fr_FR fr-latin1 Europe/Paris @@ -8,7 +10,8 @@ Italian it lat0-sun16 iso15 it_IT it Europe/Rome Japanese ja Kon None ja_JP.eucJP jp106 Asia/Tokyo Korean ko None None ko_KR.eucKR us Asia/Seoul Norwegian no lat0-sun16 iso15 no_NO no-latin1 Europe/Oslo -Portugese pt_BR lat0-sun16 iso15 pt_PT pt-latin1 Europe/Lisbon +Portuguese pt lat0-sun16 iso15 pt_PT@euro pt-latin1 Europe/Lisbon +Romanian ro lat2-sun16 iso02 ro_RO ro Europe/Bucharest Russian ru cyr-sun16 koi8-r ru_RU.koi8r ru Europe/Moscow Slovenian sl lat2-sun16 iso02 sl_SI slovene Europe/Ljubljana Spanish es lat0-sun16 iso15 es_ES es Europe/Madrid diff --git a/language.py b/language.py index 82e09f446..3361743fa 100644 --- a/language.py +++ b/language.py @@ -252,6 +252,9 @@ class Language (SimpleConfigFile): self.info['LANG'] = lang self.info['SYSFONT'] = font self.info['SYSFONTACM'] = map + # XXX hack - because of exceptional cases on the var - zh_CN.GB2312 + if lang == "zh_CN.GB18030": + self.info['LANGUAGE'] = "zh_CN.GB18030:zh_CN.GB2312:zh_CN" def setSupported (self, langlist): if len(langlist) == len(self.allSupportedLangs): diff --git a/mouse.py b/mouse.py index 8c40056dd..16f36b812 100644 --- a/mouse.py +++ b/mouse.py @@ -48,7 +48,7 @@ class Mouse (SimpleConfigFile): N_("Genius - NetScroll (PS/2)"): ("netmouse", "NetScrollPS/2", "psaux", 1, "geniusscrollps/2"), N_("Genius - NetScroll+ (PS/2)") : - ("netmouse", "NetMousePS/2", "psaux", 1, "geniusscrollps/2+"), + ("netmouse", "NetMousePS/2", "psaux", 1, "geniusscrollps/2+"), N_("Kensington - Thinking Mouse (serial)"): ("Microsoft", "ThinkingMouse", "ttyS", 1, "thinking"), N_("Kensington - Thinking Mouse (PS/2)"): @@ -219,6 +219,7 @@ class Mouse (SimpleConfigFile): # so leave it alone if (not self.info["XMOUSETYPE"] == "IMPS/2" and not self.info["XMOUSETYPE"] == "IntelliMouse" + and not self.info["XMOUSETYPE"] == "NetMousePS/2" and not self.info["XMOUSETYPE"] == "None" and not self.info["XMOUSETYPE"] == "none"): curmouse[1] = self.info["XMOUSETYPE"] @@ -232,6 +233,8 @@ class Mouse (SimpleConfigFile): pass def write(self, instPath): + if self.info["FULLNAME"] == "None - None": + return f = open(instPath + "/etc/sysconfig/mouse", "w") f.write(str (self)) f.close() diff --git a/network.py b/network.py index dd2cc32f4..977e85aab 100644 --- a/network.py +++ b/network.py @@ -215,7 +215,7 @@ class Network: fn = "%s/etc/sysconfig/network-scripts/ifcfg-%s" % (instPath, device) f = open(fn, "w") - os.chmod(fn, 0600) + os.chmod(fn, 0644) f.write(str(dev)) f.close() diff --git a/packages.py b/packages.py index 507a54fa9..9511e0363 100644 --- a/packages.py +++ b/packages.py @@ -73,7 +73,7 @@ def writeXConfiguration(id, instPath): xserver = id.videocard.primaryCard().getXServer() if not xserver: return - + log("Writing X configuration") if not flags.test: fn = instPath @@ -249,8 +249,12 @@ class InstallCallback: self.rpmFD = os.open(fn, os.O_RDONLY) # Make sure this package seems valid try: - (h, isSource) = rpm.headerFromPackage(self.rpmFD) + (hdr, isSource) = rpm.headerFromPackage(self.rpmFD) os.lseek(self.rpmFD, 0, 0) + + # if we don't have a valid package, throw an error + if not hdr: + raise SystemError except: self.rpmFD = -1 os.close(self.rpmFD) @@ -260,6 +264,8 @@ class InstallCallback: _("The file %s cannot be opened. This is due to " "a missing file, a bad package, or bad media. " "Press to try again.") % fn) + # FIXME: get should probably be inside the loop + fn = self.method.getFilename(h, self.pkgTimer) fn = self.method.unlinkFilename(fn) return self.rpmFD @@ -271,10 +277,26 @@ class InstallCallback: os.close (self.rpmFD) self.progress.completePackage(h, self.pkgTimer) self.progress.processEvents() + elif ((what == rpm.RPMCALLBACK_UNPACK_ERROR) or + (what == rpm.RPMCALLBACK_CPIO_ERROR)): + # we may want to make this error more fine-grained at some + # point + pkg = "%s-%s-%s" % (h[rpm.RPMTAG_NAME], + h[rpm.RPMTAG_VERSION], + h[rpm.RPMTAG_RELEASE]) + self.messageWindow(_("Error Installing Package"), + _("There was an error installing %s. This " + "can indicate media failure, lack of disk " + "space, and/or hardware problems. This is " + "a fatal error and your install will be " + "aborted. Please verify your media and try "+ "your install again.\n\n" + "Press the OK button to reboot " + "your system.") % (pkg,)) + sys.exit(0) else: pass -# self.progress.processEvents() + self.progress.processEvents() def __init__(self, messageWindow, progress, pkgTimer, method, progressWindowClass, instLog, modeText): @@ -381,7 +403,7 @@ def doPreInstall(method, id, intf, instPath, dir): select(id.hdList, 'kernel-tape') else: select(id.hdList, 'kernel') - elif isys.smpAvailable(): + elif isys.smpAvailable() or isys.htavailable(): select(id.hdList, 'kernel-smp') if (id.hdList.has_key('kernel-bigmem')): @@ -456,7 +478,7 @@ def doPreInstall(method, id, intf, instPath, dir): for i in ( '/var', '/var/lib', '/var/lib/rpm', '/tmp', '/dev', '/etc', '/etc/sysconfig', '/etc/sysconfig/network-scripts', - '/etc/X11' ): + '/etc/X11', '/root' ): try: os.mkdir(instPath + i) except os.error, (errno, msg): @@ -481,6 +503,9 @@ def doInstall(method, id, intf, instPath): if flags.test: return + # set up dependency white outs + import whiteout + upgrade = id.upgrade.get() db = rpm.opendb(1, instPath) ts = rpm.TransactionSet(instPath, db) @@ -518,9 +543,9 @@ def doInstall(method, id, intf, instPath): ts.order() if upgrade: - logname = '/tmp/upgrade.log' + logname = '/root/upgrade.log' else: - logname = '/tmp/install.log' + logname = '/root/install.log' instLogName = instPath + logname try: @@ -692,9 +717,9 @@ def doPostInstall(method, id, intf, instPath): arch = iutil.getArch () if upgrade: - logname = '/tmp/upgrade.log' + logname = '/root/upgrade.log' else: - logname = '/tmp/install.log' + logname = '/root/install.log' instLogName = instPath + logname instLog = open(instLogName, "a") @@ -835,12 +860,14 @@ def copyExtraModules(instPath, comps, extraModules): kernelVersions = comps.kernelVersionList() for (path, subdir, name) in extraModules: + if not path: + path = "/modules.cgz" pattern = "" names = "" for (n, tag) in kernelVersions: pattern = pattern + " " + n + "/" + name + ".o" names = names + " " + name + ".o" - command = ("cd %s/lib/modules; gunzip < %s/modules.cgz | " + command = ("cd %s/lib/modules; gunzip < %s | " "%s/bin/cpio --quiet -iumd %s" % (instPath, path, instPath, pattern)) log("running: '%s'" % (command, )) diff --git a/product.py.in b/product.py.in new file mode 100644 index 000000000..7d6a38c21 --- /dev/null +++ b/product.py.in @@ -0,0 +1,13 @@ +# +# product.py: product identification string +# +# Copyright 2002 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. + +productName = @@PRODUCTNAME@@ diff --git a/rescue.py b/rescue.py index 7643bb16a..42e204936 100644 --- a/rescue.py +++ b/rescue.py @@ -15,6 +15,7 @@ import upgrade from snack import * +from constants_text import * from text import WaitWindow, OkCancelWindow from translate import _ import sys @@ -32,6 +33,14 @@ class RescueInterface: if type == "ok": ButtonChoiceWindow(self.screen, _(title), _(text), buttons = [ _("OK") ]) + elif type == "yesno": + btnlist = [TEXT_YES_BUTTON, TEXT_NO_BUTTON] + rc = ButtonChoiceWindow(self.screen, _(title), _(text), + buttons=btnlist) + if rc == "yes": + return 1 + else: + return 0 else: return OkCancelWindow(self.screen, _(title), _(text)) @@ -41,20 +50,12 @@ class RescueInterface: # XXX grub-install is stupid and uses df output to figure out # things when installing grub. make /etc/mtab be at least # moderately useful. -def makeMtab(instPath): +def makeMtab(instPath, theFsset): child = os.fork() if (not child): os.chroot(instPath) - f = open("/proc/mounts", "r") - lines = f.readlines() - f.close() f = open("/etc/mtab", "w+") - for line in lines: - # and of course we don't want to reference dev nodes in /tmp - if line[0:5] == "/tmp/": - f.write("/dev/%s" % (line[5:])) - else: - f.write(line) + f.write(theFsset.mtab()) f.close() sys.exit(0) @@ -82,6 +83,11 @@ def runRescue(instPath, mountroot, id): isys.makeDevInode(dev, "/dev/" + dev) + # need loopback devices too + for lpminor in range(8): + dev = "loop%s" % (lpminor,) + isys.makeDevInode(dev, "/dev/" + dev) + screen = SnackScreen() intf = RescueInterface(screen) @@ -92,11 +98,13 @@ def runRescue(instPath, mountroot, id): "Linux installation and mount it under the directory " "%s. You can then make any changes required to your " "system. If you want to proceed with this step choose " - "'Continue'.\n\n" + "'Continue'. You can also choose to mount your filesystems " + "read-only instead of read-write by choosing 'Read-Only'." + "\n\n" "If for some reason this process fails you can choose 'Skip' " "and this step will be skipped and you will go directly to a " "command shell.\n\n" % (instPath,)), - [_("Continue"), _("Skip")] ) + [_("Continue"), _("Read-Only"), _("Skip")] ) if rc == string.lower(_("Skip")): screen.finish() @@ -105,6 +113,10 @@ def runRescue(instPath, mountroot, id): "system will reboot.") print os.execv("/bin/sh", [ "-/bin/sh" ]) + elif rc == string.lower(_("Read-Only")): + readOnly = 1 + else: + readOnly = 0 disks = upgrade.findExistingRoots(intf, id, instPath) @@ -140,16 +152,27 @@ def runRescue(instPath, mountroot, id): if root: try: fs = fsset.FileSystemSet() - upgrade.mountRootPartition(intf, root, fs, instPath, - allowDirty = 1) - ButtonChoiceWindow(screen, _("Rescue"), - _("Your system has been mounted under %s.\n\n" - "Press to get a shell. If you would like to " - "make your system the root environment, run the command:\n\n" - "\tchroot %s\n\nThe system will reboot " - "automatically when you exit from the shell." % (instPath, instPath)), - [_("OK")] ) - rootmounted = 1 + rc = upgrade.mountRootPartition(intf, root, fs, instPath, + allowDirty = 1, warnDirty = 1, + readOnly = readOnly) + + if rc == -1: + ButtonChoiceWindow(screen, _("Rescue"), + _("Your system had dirty filesystems which you chose not " + "to mount. Press return to get a shell from which " + "you can fsck and mount your partitions. The system " + "will reboot automatically when you exit from the " + "shell."), [_("OK")], width = 50) + rootmounted = 0 + else: + ButtonChoiceWindow(screen, _("Rescue"), + _("Your system has been mounted under /mnt/sysimage.\n\n" + "Press to get a shell. If you would like to " + "make your system the root environment, run the command:\n\n" + "\tchroot /mnt/sysimage\n\nThe system will reboot " + "automatically when you exit from the shell."), + [_("OK")] ) + rootmounted = 1 except: # This looks horrible, but all it does is catch every exception, # and reraise those in the tuple check. This lets programming @@ -175,8 +198,8 @@ def runRescue(instPath, mountroot, id): screen.finish() print - if rootmounted: - makeMtab(instPath) + if rootmounted and not readOnly: + makeMtab(instPath, fs) print _("Your system is mounted under the %s directory." % (instPath,)) print diff --git a/scripts/genlocalelist b/scripts/genlocalelist index da9082199..b2490ee29 100755 --- a/scripts/genlocalelist +++ b/scripts/genlocalelist @@ -28,16 +28,17 @@ $defaultTerritory{"Vietnamese"} = "Vietnam"; $defaultTerritory{"Turkish"} = "Turkey"; $defaultTerritory{"Thai"} = "Thailand"; -$charMap{"GB2312"} = "iso01"; -$charMap{"BIG5"} = "iso01"; -$charMap{"EUC-JP"} = "iso01"; -$charMap{"EUC-TW"} = "iso01"; -$charMap{"EUC-KR"} = "iso01"; -$charMap{"GB2312"} = "iso01"; -$charMap{"BIG5"} = "iso01"; +$charMap{"GB2312"} = "iso15"; +$charMap{"GB18030"} = "iso15"; +$charMap{"BIG5"} = "iso15"; +$charMap{"EUC-JP"} = "iso15"; +$charMap{"EUC-TW"} = "iso15"; +$charMap{"EUC-KR"} = "iso15"; +$charMap{"GB2312"} = "iso15"; +$charMap{"BIG5"} = "iso15"; $charMap{"KOI8-U"} = "koi8-u"; $charMap{"KOI8-R"} = "koi8-u"; -$charMap{"ISO-8859-1"} = "iso01"; +$charMap{"ISO-8859-1"} = "iso15"; $charMap{"ISO-8859-2"} = "iso02"; $charMap{"ISO-8859-3"} = "iso03"; $charMap{"ISO-8859-5"} = "iso05"; @@ -51,6 +52,7 @@ $charFont{"EUC-JP"} = "lat0-sun16"; $charFont{"EUC-TW"} = "lat0-sun16"; $charFont{"EUC-KR"} = "lat0-sun16"; $charFont{"GB2312"} = "lat0-sun16"; +$charFont{"GB18030"} = "lat0-sun16"; $charFont{"BIG5"} = "lat0-sun16"; $charFont{"KOI8-U"} = "cyr-sun16"; $charFont{"KOI8-R"} = "cyr-sun16"; @@ -77,13 +79,13 @@ while () { $lang=$_; $lang =~ s/eucjp/eucJP/; $lang =~ s/euckr/eucKR/; + $lang =~ s/gb18030/GB18030/; $lang =~ s/^zh_CN$/zh_CN.GB2312/; $lang =~ s/^zh_TW$/zh_TW.Big5/; # someone put nb_NO in locale.alias. yuck. We don't # want to offer that. ("nb_" eq substr($lang, 0, 3)) && next; - ("zh_CN.gb18030" eq $lang) && next; ("zh_TW.euctw" eq $lang) && next; open(INFO, "LANG=$lang locale language territory charmap|"); diff --git a/scripts/mk-images b/scripts/mk-images index acf9167b1..23deaf949 100755 --- a/scripts/mk-images +++ b/scripts/mk-images @@ -1,6 +1,7 @@ #!/bin/bash PATH=$PATH:/sbin:/usr/sbin +IMAGEUUID=$(date +%Y%m%d%H%M) usage () { echo "usage: mk-images