diff -ruN smolt-1.4.3.el4/client/Makefile smolt-1.4.3/client/Makefile --- smolt-1.4.3.el4/client/Makefile 2010-02-27 12:05:44.000000000 -0700 +++ smolt-1.4.3/client/Makefile 2010-03-03 16:53:24.000000000 -0700 @@ -6,11 +6,6 @@ NAME=smolt -ifndef DESTDIR -DESTDIR=/ -else -DESTDIR:=$(abspath $(DESTDIR)) -endif ETC=$(DESTDIR)/etc SMOLTCONFIGDIR=$(ETC)/smolt PREFIX=$(DESTDIR)/usr diff -ruN smolt-1.4.3.el4/client/os_detect.py smolt-1.4.3/client/os_detect.py --- smolt-1.4.3.el4/client/os_detect.py 2010-02-27 12:05:44.000000000 -0700 +++ smolt-1.4.3/client/os_detect.py 2010-03-03 16:53:24.000000000 -0700 @@ -1,6 +1,5 @@ import os import re -import subprocess from UserDict import UserDict class odict(UserDict): @@ -125,7 +124,7 @@ if os.path.exists(full_path_to_executable): command = [full_path_to_executable] + params try: - child = subprocess.Popen(command, stdout=subprocess.PIPE, close_fds=True) + child = os.system(' '.join(command)) except OSError: print "Warning: Could not run "+executable+", using alternate method." break # parse files instead diff -ruN smolt-1.4.3.el4/client/sendProfile.py smolt-1.4.3/client/sendProfile.py --- smolt-1.4.3.el4/client/sendProfile.py 2010-02-27 12:05:44.000000000 -0700 +++ smolt-1.4.3/client/sendProfile.py 2010-03-03 16:53:24.000000000 -0700 @@ -27,7 +27,6 @@ import random import getpass from tempfile import NamedTemporaryFile -import subprocess sys.path.append('/usr/share/smolt/client') @@ -246,7 +245,7 @@ else: #fallback to more , could use /bin/more but might as well let the path sort it out. pager_command = 'more' - subprocess.call([pager_command, f.name]) + os.system(' '.join([pager_command, f.name])) f.close() print '\n\n' else: diff -ruN smolt-1.4.3.el4/client/smoltFirstBoot.py smolt-1.4.3/client/smoltFirstBoot.py --- smolt-1.4.3.el4/client/smoltFirstBoot.py 2010-02-27 12:05:44.000000000 -0700 +++ smolt-1.4.3/client/smoltFirstBoot.py 2010-03-03 16:53:24.000000000 -0700 @@ -4,7 +4,6 @@ import gobject import sys import os -import subprocess import commands from firstboot.config import * @@ -47,8 +46,8 @@ # You'd think I know better than this. # So would I. - result = subprocess.call(['/sbin/chkconfig', 'smolt', 'on']) - result = subprocess.Popen(['/usr/bin/smoltSendProfile', '-r', '-a']) + result = os.system(' '.join(['/sbin/chkconfig', 'smolt', 'on'])) + result = os.system(' '.join(['/usr/bin/smoltSendProfile', '-r', '-a'])) return RESULT_SUCCESS else: dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE, diff -ruN smolt-1.4.3.el4/client/smolt.py smolt-1.4.3/client/smolt.py --- smolt-1.4.3.el4/client/smolt.py 2010-02-27 12:05:44.000000000 -0700 +++ smolt-1.4.3/client/smolt.py 2010-03-03 16:58:07.000000000 -0700 @@ -35,6 +35,7 @@ import dbus import software import os +import commands import urlgrabber.grabber import sys from urlparse import urljoin @@ -149,7 +150,7 @@ s = o else: s = unicode(o, current_encoding) - return codecs.encode(s, 'ascii', 'ignore') + return s class Device: def __init__(self, props, hardware): @@ -182,7 +183,10 @@ try: self.bus = props['linux.subsystem'].strip() except KeyError: - self.bus = 'Unknown' + try: + self.bus = props['info.bus'].strip() + except KeyError: + self.bus = 'Unknown' try: self.vendorid = props['%s.vendor_id' % self.bus] except KeyError: @@ -202,7 +206,10 @@ try: self.driver = props['info.linux.driver'].strip() except KeyError: - self.driver = 'Unknown' + try: + self.driver = props['net.linux.driver'].strip() + except KeyError: + self.driver = 'Unknown' class Host: def __init__(self, hostInfo): @@ -228,14 +235,22 @@ try: self.language = os.environ['LANG'] except KeyError: - self.language = 'Unknown' + try: + status, lang = commands.getstatusoutput("grep LANG /etc/sysconfig/i18n") + if status == 0: + self.language = lang.split('"')[1] + except: + self.language = 'Unknown' else: self.language = WITHHELD_MAGIC_STRING try: tempform = hostInfo['system.kernel.machine'] except KeyError: - tempform = 'Unknown' + try: + tempform = hostInfo['kernel.machine'] + except KeyError: + tempform = 'Unknown' self.platform = Gate().process('arch', tempform, WITHHELD_MAGIC_STRING) if Gate().grants('vendor'): @@ -347,15 +362,21 @@ def ignoreDevice(device): ignore = 1 - if device.bus == 'Unknown': + if device.bus == 'Unknown' or device.bus == 'unknown': return 1 - if device.bus == 'usb' and device.type == None: + if device.vendorid in (0, None) and device.type == None: return 1 if device.bus == 'usb' and device.driver == 'hub': return 1 + if device.bus == 'usb' and 'Hub' in device.description: + return 1 if device.bus == 'sound' and device.driver == 'Unknown': return 1 - if device.bus == 'pnp' and (device.driver == 'Unknown' or device.driver == 'system'): + if device.bus == 'pnp' and device.driver in ('Unknown', 'system'): + return 1 + if device.bus == 'block' and device.type == 'DISK': + return 1 + if device.bus == 'usb_device' and device.type == None: return 1 return 0 @@ -436,6 +457,57 @@ if Gate().grants('devices'): self.devices[udi] = Device(props, self) if udi == '/org/freedesktop/Hal/devices/computer': + try: + vendor = props['system.vendor'] + if len(vendor.strip()) == 0: + vendor = None + except KeyError: + try: + vendor = props['vendor'] + if len(vendor.strip()) == 0: + vendor = None + except KeyError: + vendor = None + try: + product = props['system.product'] + if len(product.strip()) == 0: + product = None + except KeyError: + try: + product = props['product'] + if len(product.strip()) == 0: + product = None + except KeyError: + product = None + if vendor is None or product is None: + i, dmiOutput, e = os.popen3("/usr/sbin/dmidecode", "r") + section = None + sysvendor = None + sysproduct = None + boardvendor = None + boardproduct = None + for line in dmiOutput: + line = line.strip() + if "Information" in line: + section = line + elif section is None: + continue + elif line.startswith("Manufacturer: ") and section.startswith("System"): + sysvendor = line.split("Manufacturer: ", 1)[1] + elif line.startswith("Product Name: ") and section.startswith("System"): + sysproduct = line.split("Product Name: ", 1)[1] + elif line.startswith("Manufacturer: ") and section.startswith("Base Board"): + boardvendor = line.split("Manufacturer: ", 1)[1] + elif line.startswith("Product Name: ") and section.startswith("Base Board"): + boardproduct = line.split("Product Name: ", 1)[1] + status = dmiOutput.close() + if status is None: + if sysvendor not in (None, 'System Manufacturer') and sysproduct not in (None, 'System Name'): + props['system.vendor'] = sysvendor + props['system.product'] = sysproduct + elif boardproduct is not None and boardproduct is not None: + props['system.vendor'] = boardvendor + props['system.product'] = boardproduct self.host = Host(props) self.fss = get_file_systems() @@ -515,14 +587,14 @@ def write_pub_uuid(self,smoonURL,pub_uuid): smoonURLparsed=urlparse(smoonURL) try: - UuidDb().set_pub_uuid(getUUID(), smoonURLparsed.hostname, pub_uuid) + UuidDb().set_pub_uuid(getUUID(), smoonURLparsed[1], pub_uuid) except Exception, e: sys.stderr.write(_('\tYour pub_uuid could not be written.\n\n')) return def write_admin_token(self,smoonURL,admin,admin_token_file): smoonURLparsed=urlparse(smoonURL) - admin_token_file += ("-"+smoonURLparsed.hostname) + admin_token_file += ("-"+smoonURLparsed[1]) try: file(admin_token_file, 'w').write(admin) except Exception, e: @@ -637,7 +709,7 @@ _('Language'):self.host.language, } lines = [] - for k, v in sorted(d.items()): + for k, v in d.items(): lines.append('%s: %s' % (k, v)) lines.append('...') return '\n'.join(lines) @@ -833,18 +905,7 @@ return 'SOCKET' if node.has_key('storage.drive_type'): - #CDROM - if node['storage.drive_type'] == 'cdrom': - return 'CDROM' - #HD - if node['storage.drive_type'] == 'disk': - return 'HD' - #FLOPPY - if node['storage.drive_type'] == 'floppy': - return 'FLOPPY' - #TAPE - if node['storage.drive_type'] == 'tape': - return 'TAPE' + return node['storage.drive_type'].upper() #PRINTER if node.has_key('printer.product'): @@ -1211,7 +1272,7 @@ def getPubUUID(user_agent=user_agent, smoonURL=smoonURL, timeout=timeout): smoonURLparsed=urlparse(smoonURL) - res = UuidDb().get_pub_uuid(getUUID(), smoonURLparsed.hostname) + res = UuidDb().get_pub_uuid(getUUID(), smoonURLparsed[1]) if res: return res @@ -1220,7 +1281,7 @@ o = grabber.urlopen(urljoin(smoonURL + "/", '/client/pub_uuid/%s' % getUUID())) pudict = simplejson.loads(o.read()) o.close() - UuidDb().set_pub_uuid(getUUID(), smoonURLparsed.hostname, pudict["pub_uuid"]) + UuidDb().set_pub_uuid(getUUID(), smoonURLparsed[1], pudict["pub_uuid"]) return pudict["pub_uuid"] except Exception, e: error(_('Error determining public UUID: %s') % e)