Revision 091c0335 image_creator/os_type/windows.py
b/image_creator/os_type/windows.py | ||
---|---|---|
116 | 116 |
def __init__(self, image, **kargs): |
117 | 117 |
super(Windows, self).__init__(image, **kargs) |
118 | 118 |
|
119 |
device = self.g.part_to_dev(self.root) |
|
119 |
device = self.image.g.part_to_dev(self.root)
|
|
120 | 120 |
|
121 |
self.last_part_num = self.g.part_list(device)[-1]['part_num'] |
|
121 |
self.last_part_num = self.image.g.part_list(device)[-1]['part_num']
|
|
122 | 122 |
self.last_drive = None |
123 | 123 |
self.system_drive = None |
124 | 124 |
|
125 |
for drive, partition in self.g.inspect_get_drive_mappings(self.root): |
|
125 |
for drive, partition in self.image.g.inspect_get_drive_mappings(self.root):
|
|
126 | 126 |
if partition == "%s%d" % (device, self.last_part_num): |
127 | 127 |
self.last_drive = drive |
128 | 128 |
if partition == self.root: |
... | ... | |
130 | 130 |
|
131 | 131 |
assert self.system_drive |
132 | 132 |
|
133 |
self.product_name = self.g.inspect_get_product_name(self.root) |
|
133 |
self.product_name = self.image.g.inspect_get_product_name(self.root)
|
|
134 | 134 |
self.syspreped = False |
135 | 135 |
|
136 | 136 |
@sysprep('Disabling IPv6 privacy extensions') |
... | ... | |
291 | 291 |
firewall_states = self._update_firewalls(0, 0, 0) |
292 | 292 |
|
293 | 293 |
# Delete the pagefile. It will be recreated when the system boots |
294 |
systemroot = self.g.inspect_get_windows_systemroot(self.root) |
|
294 |
systemroot = self.image.g.inspect_get_windows_systemroot(self.root)
|
|
295 | 295 |
try: |
296 | 296 |
pagefile = "%s/pagefile.sys" % systemroot |
297 |
self.g.rm_rf(self.g.case_sensitive_path(pagefile))
|
|
297 |
self.image.g.rm_rf(self.image.g.case_sensitive_path(pagefile))
|
|
298 | 298 |
except RuntimeError: |
299 | 299 |
pass |
300 | 300 |
|
... | ... | |
302 | 302 |
self.umount() |
303 | 303 |
|
304 | 304 |
self.out.output("Shutting down helper VM ...", False) |
305 |
self.g.sync() |
|
305 |
self.image.g.sync()
|
|
306 | 306 |
# guestfs_shutdown which is the prefered way to shutdown the backend |
307 | 307 |
# process was introduced in version 1.19.16 |
308 | 308 |
if check_guestfs_version(self.g, 1, 19, 16) >= 0: |
309 |
self.g.shutdown() |
|
309 |
self.image.g.shutdown()
|
|
310 | 310 |
else: |
311 |
self.g.kill_subprocess() |
|
311 |
self.image.g.kill_subprocess()
|
|
312 | 312 |
|
313 | 313 |
self.out.success('done') |
314 | 314 |
|
... | ... | |
383 | 383 |
finally: |
384 | 384 |
self.out.output("Relaunching helper VM (may take a while) ...", |
385 | 385 |
False) |
386 |
self.g.launch() |
|
386 |
self.image.g.launch()
|
|
387 | 387 |
self.out.success('done') |
388 | 388 |
|
389 | 389 |
self.mount(readonly=False) |
... | ... | |
426 | 426 |
def _registry_file_path(self, regfile): |
427 | 427 |
"""Retrieves the case sensitive path to a registry file""" |
428 | 428 |
|
429 |
systemroot = self.g.inspect_get_windows_systemroot(self.root) |
|
429 |
systemroot = self.image.g.inspect_get_windows_systemroot(self.root)
|
|
430 | 430 |
path = "%s/system32/config/%s" % (systemroot, regfile) |
431 | 431 |
try: |
432 |
path = self.g.case_sensitive_path(path) |
|
432 |
path = self.image.g.case_sensitive_path(path)
|
|
433 | 433 |
except RuntimeError as error: |
434 | 434 |
raise FatalError("Unable to retrieve registry file: %s. Reason: %s" |
435 | 435 |
% (regfile, str(error))) |
... | ... | |
446 | 446 |
softwarefd, software = tempfile.mkstemp() |
447 | 447 |
try: |
448 | 448 |
os.close(softwarefd) |
449 |
self.g.download(path, software) |
|
449 |
self.image.g.download(path, software)
|
|
450 | 450 |
|
451 | 451 |
h = hivex.Hivex(software, write=True) |
452 | 452 |
|
... | ... | |
511 | 511 |
|
512 | 512 |
h.commit(None) |
513 | 513 |
|
514 |
self.g.upload(software, path) |
|
514 |
self.image.g.upload(software, path)
|
|
515 | 515 |
finally: |
516 | 516 |
os.unlink(software) |
517 | 517 |
|
... | ... | |
537 | 537 |
systemfd, system = tempfile.mkstemp() |
538 | 538 |
try: |
539 | 539 |
os.close(systemfd) |
540 |
self.g.download(path, system) |
|
540 |
self.image.g.download(path, system)
|
|
541 | 541 |
|
542 | 542 |
h = hivex.Hivex(system, write=True) |
543 | 543 |
|
... | ... | |
569 | 569 |
'value': struct.pack("<I", new_values.pop(0))}) |
570 | 570 |
|
571 | 571 |
h.commit(None) |
572 |
self.g.upload(system, path) |
|
572 |
self.image.g.upload(system, path)
|
|
573 | 573 |
|
574 | 574 |
finally: |
575 | 575 |
os.unlink(system) |
... | ... | |
598 | 598 |
softwarefd, software = tempfile.mkstemp() |
599 | 599 |
try: |
600 | 600 |
os.close(softwarefd) |
601 |
self.g.download(path, software) |
|
601 |
self.image.g.download(path, software)
|
|
602 | 602 |
|
603 | 603 |
h = hivex.Hivex(software, write=True) |
604 | 604 |
|
... | ... | |
625 | 625 |
h.node_set_value(key, new_value) |
626 | 626 |
h.commit(None) |
627 | 627 |
|
628 |
self.g.upload(software, path) |
|
628 |
self.image.g.upload(software, path)
|
|
629 | 629 |
|
630 | 630 |
finally: |
631 | 631 |
os.unlink(software) |
... | ... | |
642 | 642 |
samfd, sam = tempfile.mkstemp() |
643 | 643 |
try: |
644 | 644 |
os.close(samfd) |
645 |
self.g.download(self._registry_file_path('SAM'), sam) |
|
645 |
self.image.g.download(self._registry_file_path('SAM'), sam)
|
|
646 | 646 |
|
647 | 647 |
h = hivex.Hivex(sam) |
648 | 648 |
|
Also available in: Unified diff