def _doJobCheckVirus(self): work = FvmWorkOnLineExec() work.setWorkName("Check virus") work.addZipFile(os.path.join(self.dataDir, "baidusd.zip")) work.setExecFileInfo(os.path.join(self.dataDir, "exec-check-virus.au3")) work.setReqList(["network"]) return work
def _doJobAddDesktopShortcut(self, value): rPosition = "" rName = "" rTarget = "" rAccelerator = "" for vi in value.split(";"): if vi == "position:desktop": rPosition = "desktop" elif vi == "position:quick-launch-bar": assert False # rPosition = "quick-launch" elif vi.startswith("name:"): rName = vi[5:] elif vi.startswith("target:"): rTarget = vi[7:] elif vi.startswith("accelerator:"): rAccelerator = vi[12:0] else: assert False if rPosition == "": raise Exception("Invalid position value") if rName == "": raise Exception("Invalid name value") if rTarget == "": raise Exception("Invalid target value") work = FvmWorkOnLineExec() work.setWorkName("Add Desktop Shortcut") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-add-desktop-shortcut.au3"), [rPosition, rName, rTarget, rAccelerator]) return work
def _doJobSetControlPanelStyle(self, value): if value != "category" and value != "classic": raise Exception("invalid option value \"%s\", must be \"category|classic\"" % (value)) work = FvmWorkOnLineExec() work.setWorkName("Configure explorer search option") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-set-control-panel-style.au3"), [value]) return work
def _doJobSetDesktopPerformance(self, value): if value != "effect" and value != "speed": raise Exception("invalid option value \"%s\", must be \"effect|speed\"" % (value)) work = FvmWorkOnLineExec() work.setWorkName("Configure desktop performance") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-set-desktop-performance.au3"), [value]) return work
def _doJobSetErrorReport(self, value): if value != "enable" and value != "disable": raise Exception("invalid option value \"%s\", must be \"enable|disable\"" % (value)) work = FvmWorkOnLineExec() work.setWorkName("Configure explorer search option") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-set-error-report.au3"), [value]) return work
def _doJobSetExplorerView(self, opt, value): viewList = ["default", "thumbnail", "title", "icon", "list", "detail"] if value not in viewList: raise Exception("invalid option \"%s\", the speicified view is invalid" % (opt)) work = FvmWorkOnLineExec() work.setWorkName("Configure explorer view") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-set-explorer-view.au3"), [value]) return work
def _doJobSetWmpOption(self, value): optList = ["minimize-to-taskbar:on", "minimize-to-taskbar:off"] valueList = value.split(";") o = FvmUtil.notInList(valueList, optList) if o is not None: raise Exception("invalid option \"%s\"" % (o)) work = FvmWorkOnLineExec() work.setWorkName("Configure Windows Media Player") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-set-wmp-option.au3"), [value]) return work
def _doJobSetTaskmgrOption(self, value): optList = ["auto-start:on", "auto-start:off", "hide-when-minimized:on", "hide-when-minimized:off"] valueList = value.split(";") o = FvmUtil.notInList(valueList, optList) if o is not None: raise Exception("invalid option \"%s\"" % (o)) work = FvmWorkOnLineExec() work.setWorkName("Configure Task Manager") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-set-taskmgr-option.au3"), valueList) return work
def _doJobSetScreenResolution(self, opt, value): resList = ["800x600", "832x624", "960x640", "1024x600", "1024x768", "1152x864", "1152x870", "1280x720", "1280x760", "1280x768", "1280x800", "1280x960", "1280x1024", "1360x768", "1366x768", "1400x1050", "1440x900", "1600x900", "1600x1200", "1680x1050", "1920x1080", "1920x1200", "1920x1440", "2048x1536", "2560x1440", "2560x1600", "2560x2048", "2800x2100", "3200x2400"] if value not in resList: raise Exception("invalid option \"%s\", the specified screen-resolution value is invalid" % (opt)) work = FvmWorkOnLineExec() work.setWorkName("Configure screen resolution") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-set-screen-resolution.au3"), [value]) return work
def _doJobSetDesktopOption(self, value): optList = ["sort-icon:on", "sort-icon:off"] valueList = value.split(";") o = FvmUtil.notInList(valueList, optList) if o is not None: raise Exception("invalid option \"%s\"" % (o)) work = FvmWorkOnLineExec() work.setWorkName("Configure desktop option") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-set-desktop-option.au3"), valueList) return work
def _doJobSetExplorerOption(self, value): optList = ["file-ext:show", "file-ext:hide", "hidden-file:show", "hidden-file:hide", "extra-tip:show", "extra-tip:hide"] valueList = value.split(";") o = FvmUtil.notInList(valueList, optList) if o is not None: raise Exception("invalid option \"%s\"" % (o)) work = FvmWorkOnLineExec() work.setWorkName("Configure explorer option") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-set-explorer-option.au3"), valueList) return work
def _doJobSetExplorerSearchOption(self, value): optList = ["balloon-prompt:on", "balloon-prompt:off", "auto-completion:on", "auto-completion:off", "animation:on", "animation:off", "indexing:on", "indexing:off"] valueList = value.split(";") o = FvmUtil.notInList(valueList, optList) if o is not None: raise Exception("invalid option \"%s\"" % (o)) work = FvmWorkOnLineExec() work.setWorkName("Configure explorer search option") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-set-explorer-search-option.au3"), valueList) return work
def _doJobSetStartMenuOption(self, value): optList = ["style:winxp", "style:classic", "auto-hide:on", "auto-hide:off", "inactive-tray-icon:show", "inactive-tray-icon:hide", "group-task:on", "group-task:off", "quick-bar:on", "quick-bar:off", "balloon-tips:on", "balloon-tips:off"] valueList = value.split(";") o = FvmUtil.notInList(valueList, optList) if o is not None: raise Exception("invalid option \"%s\"" % (o)) work = FvmWorkOnLineExec() work.setWorkName("Configure start menu option") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-set-start-menu-option.au3"), valueList) return work
def doInitialConfigure(self, param, vmInfo): self._checkOsPlugin(vmInfo) osName = FvmUtil.getVmOsName(vmInfo) workList = [] work = FvmWorkOnLineExec() work.setWorkName("Enable auto update") work.setExecFileInfo(os.path.join(self.dataDir, "autocfg-enable-auto-update.au3")) workList.append(work) work = FvmWorkOnLineExec() work.setWorkName("Configure input method") work.setExecFileInfo(os.path.join(self.dataDir, "autocfg-init-input-method.au3")) workList.append(work) work = FvmWorkOnLineExec() work.setWorkName("Update windows installer") work.addFile(os.path.join(self.dataDir, "WindowsXP-KB942288-v3-x86.exe"), True) work.setExecFileInfo(os.path.join(self.dataDir, "autocfg-update-windows-installer.au3")) workList.append(work) work = FvmWorkOnLineExec() work.setWorkName("Configure Windows Media Player 9") work.setExecFileInfo(os.path.join(self.dataDir, "autocfg-init-wmp9.au3")) work.setReqList(["noNetwork"]) workList.append(work) work = FvmWorkOnLineExec() work.setWorkName("Install Internet Explorer 8") if osName.endswith(".X86.zh_CN"): work.addFile(os.path.join(self.dataDir, "IE8-WindowsXP-x86-CHS.exe"), True) else: assert False work.setExecFileInfo(os.path.join(self.dataDir, "autocfg-init-ie8.au3")) work.setReqList(["noNetwork", "rebootAndShutdown"]) # noNetwork can quicken the installation # IE8 setup program needs rebooting workList.append(work) return workList
def _doJobInstallPatch(self, osName, value): workList = [] for vi in value.split(";"): if vi == "wmp11": work = FvmWorkOnLineExec() work.setWorkName("Install Windows Media Player 11") if osName.endswith(".X86.zh_CN"): work.addFile(os.path.join(self.dataDir, "wmp11-windowsxp-x86-ZH-CN.exe"), True) else: assert False work.setExecFileInfo(os.path.join(self.dataDir, "cfg-install-wmp11.au3")) work.setReqList(["noNetwork"]) elif vi == "flash-player": work = FvmWorkOnLineExec() work.setWorkName("Install Flash Player") work.addFile(os.path.join(self.dataDir, "install_flash_player.exe"), True) work.addFile(os.path.join(self.dataDir, "install_flash_player_ax.exe"), True) work.setExecFileInfo(os.path.join(self.dataDir, "cfg-install-flash-player.au3")) work.setReqList(["noNetwork"]) elif vi == "jre": work = FvmWorkOnLineExec() work.setWorkName("Install JRE") work.addFile(os.path.join(self.dataDir, "jre-7u17-windows-i586.exe"), True) work.addFile(os.path.join(self.dataDir, "jre-7u17-windows-x64.exe"), True) work.setExecFileInfo(os.path.join(self.dataDir, "cfg-install-jre.au3")) work.setReqList(["noNetwork"]) elif vi == "dot-net-framework": assert False elif vi == "directx": assert False else: raise Exception("invalid patch \"%s\"" % (vi)) workList.append(work) return workList
def _doJobSetDesktopTheme(self, value): work = FvmWorkOnLineExec() work.setWorkName("Configure desktop theme") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-set-desktop-theme.au3"), [value]) return work
def _doJobSetIeMainPage(self, value): work = FvmWorkOnLineExec() work.setWorkName("Configure Internet Explorer main page") work.setExecFileInfo(os.path.join(self.dataDir, "cfg-set-ie-main-page.au3"), [value]) return work