1 |
slords |
1.1 |
diff -ruN smolt-1.4.3.el4/client/Makefile smolt-1.4.3/client/Makefile |
2 |
|
|
--- smolt-1.4.3.el4/client/Makefile 2010-02-27 12:05:44.000000000 -0700 |
3 |
|
|
+++ smolt-1.4.3/client/Makefile 2010-03-03 16:53:24.000000000 -0700 |
4 |
|
|
@@ -6,11 +6,6 @@ |
5 |
|
|
|
6 |
|
|
|
7 |
|
|
NAME=smolt |
8 |
|
|
-ifndef DESTDIR |
9 |
|
|
-DESTDIR=/ |
10 |
|
|
-else |
11 |
|
|
-DESTDIR:=$(abspath $(DESTDIR)) |
12 |
|
|
-endif |
13 |
|
|
ETC=$(DESTDIR)/etc |
14 |
|
|
SMOLTCONFIGDIR=$(ETC)/smolt |
15 |
|
|
PREFIX=$(DESTDIR)/usr |
16 |
|
|
diff -ruN smolt-1.4.3.el4/client/os_detect.py smolt-1.4.3/client/os_detect.py |
17 |
|
|
--- smolt-1.4.3.el4/client/os_detect.py 2010-02-27 12:05:44.000000000 -0700 |
18 |
|
|
+++ smolt-1.4.3/client/os_detect.py 2010-03-03 16:53:24.000000000 -0700 |
19 |
|
|
@@ -1,6 +1,5 @@ |
20 |
|
|
import os |
21 |
|
|
import re |
22 |
|
|
-import subprocess |
23 |
|
|
from UserDict import UserDict |
24 |
|
|
|
25 |
|
|
class odict(UserDict): |
26 |
|
|
@@ -125,7 +124,7 @@ |
27 |
|
|
if os.path.exists(full_path_to_executable): |
28 |
|
|
command = [full_path_to_executable] + params |
29 |
|
|
try: |
30 |
|
|
- child = subprocess.Popen(command, stdout=subprocess.PIPE, close_fds=True) |
31 |
|
|
+ child = os.system(' '.join(command)) |
32 |
|
|
except OSError: |
33 |
|
|
print "Warning: Could not run "+executable+", using alternate method." |
34 |
|
|
break # parse files instead |
35 |
|
|
diff -ruN smolt-1.4.3.el4/client/sendProfile.py smolt-1.4.3/client/sendProfile.py |
36 |
|
|
--- smolt-1.4.3.el4/client/sendProfile.py 2010-02-27 12:05:44.000000000 -0700 |
37 |
|
|
+++ smolt-1.4.3/client/sendProfile.py 2010-03-03 16:53:24.000000000 -0700 |
38 |
|
|
@@ -27,7 +27,6 @@ |
39 |
|
|
import random |
40 |
|
|
import getpass |
41 |
|
|
from tempfile import NamedTemporaryFile |
42 |
|
|
-import subprocess |
43 |
|
|
|
44 |
|
|
sys.path.append('/usr/share/smolt/client') |
45 |
|
|
|
46 |
|
|
@@ -246,7 +245,7 @@ |
47 |
|
|
else: |
48 |
|
|
#fallback to more , could use /bin/more but might as well let the path sort it out. |
49 |
|
|
pager_command = 'more' |
50 |
|
|
- subprocess.call([pager_command, f.name]) |
51 |
|
|
+ os.system(' '.join([pager_command, f.name])) |
52 |
|
|
f.close() |
53 |
|
|
print '\n\n' |
54 |
|
|
else: |
55 |
|
|
diff -ruN smolt-1.4.3.el4/client/smoltFirstBoot.py smolt-1.4.3/client/smoltFirstBoot.py |
56 |
|
|
--- smolt-1.4.3.el4/client/smoltFirstBoot.py 2010-02-27 12:05:44.000000000 -0700 |
57 |
|
|
+++ smolt-1.4.3/client/smoltFirstBoot.py 2010-03-03 16:53:24.000000000 -0700 |
58 |
|
|
@@ -4,7 +4,6 @@ |
59 |
|
|
import gobject |
60 |
|
|
import sys |
61 |
|
|
import os |
62 |
|
|
-import subprocess |
63 |
|
|
import commands |
64 |
|
|
|
65 |
|
|
from firstboot.config import * |
66 |
|
|
@@ -47,8 +46,8 @@ |
67 |
|
|
|
68 |
|
|
# You'd think I know better than this. |
69 |
|
|
# So would I. |
70 |
|
|
- result = subprocess.call(['/sbin/chkconfig', 'smolt', 'on']) |
71 |
|
|
- result = subprocess.Popen(['/usr/bin/smoltSendProfile', '-r', '-a']) |
72 |
|
|
+ result = os.system(' '.join(['/sbin/chkconfig', 'smolt', 'on'])) |
73 |
|
|
+ result = os.system(' '.join(['/usr/bin/smoltSendProfile', '-r', '-a'])) |
74 |
|
|
return RESULT_SUCCESS |
75 |
|
|
else: |
76 |
|
|
dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE, |
77 |
|
|
diff -ruN smolt-1.4.3.el4/client/smolt.py smolt-1.4.3/client/smolt.py |
78 |
|
|
--- smolt-1.4.3.el4/client/smolt.py 2010-02-27 12:05:44.000000000 -0700 |
79 |
|
|
+++ smolt-1.4.3/client/smolt.py 2010-03-03 16:58:07.000000000 -0700 |
80 |
|
|
@@ -35,6 +35,7 @@ |
81 |
|
|
import dbus |
82 |
|
|
import software |
83 |
|
|
import os |
84 |
|
|
+import commands |
85 |
|
|
import urlgrabber.grabber |
86 |
|
|
import sys |
87 |
|
|
from urlparse import urljoin |
88 |
|
|
@@ -149,7 +150,7 @@ |
89 |
|
|
s = o |
90 |
|
|
else: |
91 |
|
|
s = unicode(o, current_encoding) |
92 |
|
|
- return codecs.encode(s, 'ascii', 'ignore') |
93 |
|
|
+ return s |
94 |
|
|
|
95 |
|
|
class Device: |
96 |
|
|
def __init__(self, props, hardware): |
97 |
|
|
@@ -182,7 +183,10 @@ |
98 |
|
|
try: |
99 |
|
|
self.bus = props['linux.subsystem'].strip() |
100 |
|
|
except KeyError: |
101 |
|
|
- self.bus = 'Unknown' |
102 |
|
|
+ try: |
103 |
|
|
+ self.bus = props['info.bus'].strip() |
104 |
|
|
+ except KeyError: |
105 |
|
|
+ self.bus = 'Unknown' |
106 |
|
|
try: |
107 |
|
|
self.vendorid = props['%s.vendor_id' % self.bus] |
108 |
|
|
except KeyError: |
109 |
|
|
@@ -202,7 +206,10 @@ |
110 |
|
|
try: |
111 |
|
|
self.driver = props['info.linux.driver'].strip() |
112 |
|
|
except KeyError: |
113 |
|
|
- self.driver = 'Unknown' |
114 |
|
|
+ try: |
115 |
|
|
+ self.driver = props['net.linux.driver'].strip() |
116 |
|
|
+ except KeyError: |
117 |
|
|
+ self.driver = 'Unknown' |
118 |
|
|
|
119 |
|
|
class Host: |
120 |
|
|
def __init__(self, hostInfo): |
121 |
|
|
@@ -228,14 +235,22 @@ |
122 |
|
|
try: |
123 |
|
|
self.language = os.environ['LANG'] |
124 |
|
|
except KeyError: |
125 |
|
|
- self.language = 'Unknown' |
126 |
|
|
+ try: |
127 |
|
|
+ status, lang = commands.getstatusoutput("grep LANG /etc/sysconfig/i18n") |
128 |
|
|
+ if status == 0: |
129 |
|
|
+ self.language = lang.split('"')[1] |
130 |
|
|
+ except: |
131 |
|
|
+ self.language = 'Unknown' |
132 |
|
|
else: |
133 |
|
|
self.language = WITHHELD_MAGIC_STRING |
134 |
|
|
|
135 |
|
|
try: |
136 |
|
|
tempform = hostInfo['system.kernel.machine'] |
137 |
|
|
except KeyError: |
138 |
|
|
- tempform = 'Unknown' |
139 |
|
|
+ try: |
140 |
|
|
+ tempform = hostInfo['kernel.machine'] |
141 |
|
|
+ except KeyError: |
142 |
|
|
+ tempform = 'Unknown' |
143 |
|
|
self.platform = Gate().process('arch', tempform, WITHHELD_MAGIC_STRING) |
144 |
|
|
|
145 |
|
|
if Gate().grants('vendor'): |
146 |
|
|
@@ -347,15 +362,21 @@ |
147 |
|
|
|
148 |
|
|
def ignoreDevice(device): |
149 |
|
|
ignore = 1 |
150 |
|
|
- if device.bus == 'Unknown': |
151 |
|
|
+ if device.bus == 'Unknown' or device.bus == 'unknown': |
152 |
|
|
return 1 |
153 |
|
|
- if device.bus == 'usb' and device.type == None: |
154 |
|
|
+ if device.vendorid in (0, None) and device.type == None: |
155 |
|
|
return 1 |
156 |
|
|
if device.bus == 'usb' and device.driver == 'hub': |
157 |
|
|
return 1 |
158 |
|
|
+ if device.bus == 'usb' and 'Hub' in device.description: |
159 |
|
|
+ return 1 |
160 |
|
|
if device.bus == 'sound' and device.driver == 'Unknown': |
161 |
|
|
return 1 |
162 |
|
|
- if device.bus == 'pnp' and (device.driver == 'Unknown' or device.driver == 'system'): |
163 |
|
|
+ if device.bus == 'pnp' and device.driver in ('Unknown', 'system'): |
164 |
|
|
+ return 1 |
165 |
|
|
+ if device.bus == 'block' and device.type == 'DISK': |
166 |
|
|
+ return 1 |
167 |
|
|
+ if device.bus == 'usb_device' and device.type == None: |
168 |
|
|
return 1 |
169 |
|
|
return 0 |
170 |
|
|
|
171 |
|
|
@@ -436,6 +457,57 @@ |
172 |
|
|
if Gate().grants('devices'): |
173 |
|
|
self.devices[udi] = Device(props, self) |
174 |
|
|
if udi == '/org/freedesktop/Hal/devices/computer': |
175 |
|
|
+ try: |
176 |
|
|
+ vendor = props['system.vendor'] |
177 |
|
|
+ if len(vendor.strip()) == 0: |
178 |
|
|
+ vendor = None |
179 |
|
|
+ except KeyError: |
180 |
|
|
+ try: |
181 |
|
|
+ vendor = props['vendor'] |
182 |
|
|
+ if len(vendor.strip()) == 0: |
183 |
|
|
+ vendor = None |
184 |
|
|
+ except KeyError: |
185 |
|
|
+ vendor = None |
186 |
|
|
+ try: |
187 |
|
|
+ product = props['system.product'] |
188 |
|
|
+ if len(product.strip()) == 0: |
189 |
|
|
+ product = None |
190 |
|
|
+ except KeyError: |
191 |
|
|
+ try: |
192 |
|
|
+ product = props['product'] |
193 |
|
|
+ if len(product.strip()) == 0: |
194 |
|
|
+ product = None |
195 |
|
|
+ except KeyError: |
196 |
|
|
+ product = None |
197 |
|
|
+ if vendor is None or product is None: |
198 |
|
|
+ i, dmiOutput, e = os.popen3("/usr/sbin/dmidecode", "r") |
199 |
|
|
+ section = None |
200 |
|
|
+ sysvendor = None |
201 |
|
|
+ sysproduct = None |
202 |
|
|
+ boardvendor = None |
203 |
|
|
+ boardproduct = None |
204 |
|
|
+ for line in dmiOutput: |
205 |
|
|
+ line = line.strip() |
206 |
|
|
+ if "Information" in line: |
207 |
|
|
+ section = line |
208 |
|
|
+ elif section is None: |
209 |
|
|
+ continue |
210 |
|
|
+ elif line.startswith("Manufacturer: ") and section.startswith("System"): |
211 |
|
|
+ sysvendor = line.split("Manufacturer: ", 1)[1] |
212 |
|
|
+ elif line.startswith("Product Name: ") and section.startswith("System"): |
213 |
|
|
+ sysproduct = line.split("Product Name: ", 1)[1] |
214 |
|
|
+ elif line.startswith("Manufacturer: ") and section.startswith("Base Board"): |
215 |
|
|
+ boardvendor = line.split("Manufacturer: ", 1)[1] |
216 |
|
|
+ elif line.startswith("Product Name: ") and section.startswith("Base Board"): |
217 |
|
|
+ boardproduct = line.split("Product Name: ", 1)[1] |
218 |
|
|
+ status = dmiOutput.close() |
219 |
|
|
+ if status is None: |
220 |
|
|
+ if sysvendor not in (None, 'System Manufacturer') and sysproduct not in (None, 'System Name'): |
221 |
|
|
+ props['system.vendor'] = sysvendor |
222 |
|
|
+ props['system.product'] = sysproduct |
223 |
|
|
+ elif boardproduct is not None and boardproduct is not None: |
224 |
|
|
+ props['system.vendor'] = boardvendor |
225 |
|
|
+ props['system.product'] = boardproduct |
226 |
|
|
self.host = Host(props) |
227 |
|
|
|
228 |
|
|
self.fss = get_file_systems() |
229 |
|
|
@@ -515,14 +587,14 @@ |
230 |
|
|
def write_pub_uuid(self,smoonURL,pub_uuid): |
231 |
|
|
smoonURLparsed=urlparse(smoonURL) |
232 |
|
|
try: |
233 |
|
|
- UuidDb().set_pub_uuid(getUUID(), smoonURLparsed.hostname, pub_uuid) |
234 |
|
|
+ UuidDb().set_pub_uuid(getUUID(), smoonURLparsed[1], pub_uuid) |
235 |
|
|
except Exception, e: |
236 |
|
|
sys.stderr.write(_('\tYour pub_uuid could not be written.\n\n')) |
237 |
|
|
return |
238 |
|
|
|
239 |
|
|
def write_admin_token(self,smoonURL,admin,admin_token_file): |
240 |
|
|
smoonURLparsed=urlparse(smoonURL) |
241 |
|
|
- admin_token_file += ("-"+smoonURLparsed.hostname) |
242 |
|
|
+ admin_token_file += ("-"+smoonURLparsed[1]) |
243 |
|
|
try: |
244 |
|
|
file(admin_token_file, 'w').write(admin) |
245 |
|
|
except Exception, e: |
246 |
|
|
@@ -637,7 +709,7 @@ |
247 |
|
|
_('Language'):self.host.language, |
248 |
|
|
} |
249 |
|
|
lines = [] |
250 |
|
|
- for k, v in sorted(d.items()): |
251 |
|
|
+ for k, v in d.items(): |
252 |
|
|
lines.append('%s: %s' % (k, v)) |
253 |
|
|
lines.append('...') |
254 |
|
|
return '\n'.join(lines) |
255 |
|
|
@@ -833,18 +905,7 @@ |
256 |
|
|
return 'SOCKET' |
257 |
|
|
|
258 |
|
|
if node.has_key('storage.drive_type'): |
259 |
|
|
- #CDROM |
260 |
|
|
- if node['storage.drive_type'] == 'cdrom': |
261 |
|
|
- return 'CDROM' |
262 |
|
|
- #HD |
263 |
|
|
- if node['storage.drive_type'] == 'disk': |
264 |
|
|
- return 'HD' |
265 |
|
|
- #FLOPPY |
266 |
|
|
- if node['storage.drive_type'] == 'floppy': |
267 |
|
|
- return 'FLOPPY' |
268 |
|
|
- #TAPE |
269 |
|
|
- if node['storage.drive_type'] == 'tape': |
270 |
|
|
- return 'TAPE' |
271 |
|
|
+ return node['storage.drive_type'].upper() |
272 |
|
|
|
273 |
|
|
#PRINTER |
274 |
|
|
if node.has_key('printer.product'): |
275 |
|
|
@@ -1211,7 +1272,7 @@ |
276 |
|
|
|
277 |
|
|
def getPubUUID(user_agent=user_agent, smoonURL=smoonURL, timeout=timeout): |
278 |
|
|
smoonURLparsed=urlparse(smoonURL) |
279 |
|
|
- res = UuidDb().get_pub_uuid(getUUID(), smoonURLparsed.hostname) |
280 |
|
|
+ res = UuidDb().get_pub_uuid(getUUID(), smoonURLparsed[1]) |
281 |
|
|
if res: |
282 |
|
|
return res |
283 |
|
|
|
284 |
|
|
@@ -1220,7 +1281,7 @@ |
285 |
|
|
o = grabber.urlopen(urljoin(smoonURL + "/", '/client/pub_uuid/%s' % getUUID())) |
286 |
|
|
pudict = simplejson.loads(o.read()) |
287 |
|
|
o.close() |
288 |
|
|
- UuidDb().set_pub_uuid(getUUID(), smoonURLparsed.hostname, pudict["pub_uuid"]) |
289 |
|
|
+ UuidDb().set_pub_uuid(getUUID(), smoonURLparsed[1], pudict["pub_uuid"]) |
290 |
|
|
return pudict["pub_uuid"] |
291 |
|
|
except Exception, e: |
292 |
|
|
error(_('Error determining public UUID: %s') % e) |