settings-wni-Windows_NT.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/python2
  2. from __future__ import absolute_import
  3. import _winreg
  4. import os
  5. import sys
  6. from qubes.storage.wni import QubesWniVmStorage
  7. DEFAULT_INSTALLDIR = 'c:\\program files\\Invisible Things Lab\\Qubes WNI'
  8. DEFAULT_STOREDIR = 'c:\\qubes'
  9. def apply(system_path, vm_files, defaults):
  10. system_path['qubes_base_dir'] = DEFAULT_STOREDIR
  11. installdir = DEFAULT_INSTALLDIR
  12. try:
  13. reg_key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
  14. "Software\\Invisible Things Lab\\Qubes WNI")
  15. installdir = _winreg.QueryValueEx(reg_key, "InstallDir")[0]
  16. system_path['qubes_base_dir'] = \
  17. _winreg.QueryValueEx(reg_key, "StoreDir")[0]
  18. except WindowsError as e:
  19. print >>sys.stderr, \
  20. "WARNING: invalid installation: missing registry entries (%s)" \
  21. % str(e)
  22. system_path['config_template_pv'] = \
  23. os.path.join(installdir, 'vm-template.xml')
  24. system_path['config_template_hvm'] = \
  25. os.path.join(installdir, 'vm-template-hvm.xml')
  26. system_path['qubes_icon_dir'] = os.path.join(installdir, 'icons')
  27. system_path['qubesdb_daemon_path'] = \
  28. os.path.join(installdir, 'bin\\qubesdb-daemon.exe')
  29. system_path['qrexec_daemon_path'] = \
  30. os.path.join(installdir, 'bin\\qrexec-daemon.exe')
  31. system_path['qrexec_client_path'] = \
  32. os.path.join(installdir, 'bin\\qrexec-client.exe')
  33. system_path['qrexec_policy_dir'] = \
  34. os.path.join(installdir, 'qubes-rpc\\policy')
  35. # Specific to WNI - normally VM have this file
  36. system_path['qrexec_agent_path'] = \
  37. os.path.join(installdir, 'bin\\qrexec-agent.exe')
  38. defaults['libvirt_uri'] = 'wni:///'
  39. defaults['storage_class'] = QubesWniVmStorage