summaryrefslogtreecommitdiffstats
path: root/packages.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2002-07-18 05:38:14 +0000
committerJeremy Katz <katzj@redhat.com>2002-07-18 05:38:14 +0000
commit3a31bd5f239a7c3b50afb26ca6ff59efadef06cb (patch)
tree338cf18dd587316af07ab1bc6eed639abf506f90 /packages.py
parent0a7c50beb11632c613770705cc3178d807b8aca8 (diff)
downloadanaconda-3a31bd5f239a7c3b50afb26ca6ff59efadef06cb.tar.gz
anaconda-3a31bd5f239a7c3b50afb26ca6ff59efadef06cb.tar.xz
anaconda-3a31bd5f239a7c3b50afb26ca6ff59efadef06cb.zip
check the md5sig of a package before we try to install it. this should give us a much better chance of not hitting weird cases where we can't eject the cd. also, symlink /var/tmp to /mnt/sysimage/var/tmp so that we have tmpspace for the rpm md5 bits
Diffstat (limited to 'packages.py')
-rw-r--r--packages.py45
1 files changed, 39 insertions, 6 deletions
diff --git a/packages.py b/packages.py
index 94c366c84..cdaef0b22 100644
--- a/packages.py
+++ b/packages.py
@@ -162,6 +162,26 @@ def handleX11Packages(dir, intf, disp, id, instPath):
if gnomeSelected or kdeSelected:
id.desktop.setDefaultRunLevel(5)
+def checksig(fileName):
+ # RPM spews to stdout/stderr. Redirect.
+ # stolen from up2date/up2date.py
+ saveStdout = os.dup(1)
+ saveStderr = os.dup(2)
+ redirStdout = os.open("/dev/null", os.O_WRONLY | os.O_APPEND)
+ redirStderr = os.open("/dev/null", os.O_WRONLY | os.O_APPEND)
+ os.dup2(redirStdout, 1)
+ os.dup2(redirStderr, 2)
+ # now do the rpm thing
+ ret = rpm.checksig(fileName, rpm.CHECKSIG_MD5)
+ # restore normal stdout and stderr
+ os.dup2(saveStdout, 1)
+ os.dup2(saveStderr, 2)
+ # Clean up
+ os.close(redirStdout)
+ os.close(redirStderr)
+ os.close(saveStdout)
+ os.close(saveStderr)
+ return ret
def checkDependencies(dir, intf, disp, id, instPath):
if dir == DISPATCH_BACK:
@@ -254,12 +274,16 @@ class InstallCallback:
h[rpm.RPMTAG_VERSION],
h[rpm.RPMTAG_RELEASE]))
self.instLog.flush ()
- fn = self.method.getFilename(h, self.pkgTimer)
self.rpmFD = -1
self.size = h[rpm.RPMTAG_SIZE]
while self.rpmFD < 0:
+ fn = self.method.getFilename(h, self.pkgTimer)
try:
+ ret = checksig(fn)
+# log("return of checksig for %s is %s" %(fn, ret))
+ if ret != 0:
+ raise SystemError
self.rpmFD = os.open(fn, os.O_RDONLY)
# Make sure this package seems valid
try:
@@ -498,14 +522,23 @@ 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', '/root' ):
+ '/etc/X11', '/root', '/var/tmp' ):
try:
os.mkdir(instPath + i)
except os.error, (errno, msg):
- #self.intf.messageWindow("Error",
- # "Error making directory %s: "
- # "%s" % (i, msg))
- pass
+ pass
+# log("Error making directory %s: %s" % (i, msg))
+
+
+ try:
+ os.symlink("/mnt/sysimage/var/tmp", "/var/tmp")
+ except:
+ intf.messageWindow(_("Error"),
+ _("Unable to create symlink for /var/tmp. This "
+ "should only happen if there were errors "
+ "creating your filesystems.\n\n"
+ "Press the OK button to reboot your system."))
+ sys.exit(0)
# write out the fstab
if not upgrade: