def updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel = None): if pComponent["componenttype"] == Cassette.componentType: return Cassette.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Add.componentType: return Add.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Evaporate.componentType: return Evaporate.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Transfer.componentType: return Transfer.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == React.componentType: return React.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Prompt.componentType: return Prompt.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Install.componentType: return Install.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Comment.componentType: return Comment.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == TrapF18.componentType: return TrapF18.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == EluteF18.componentType: return EluteF18.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Initialize.componentType: return Initialize.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Mix.componentType: return Mix.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Move.componentType: return Move.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Summary.componentType: return Summary.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == ExternalAdd.componentType: return ExternalAdd.updateToComponent(pUnitOperation, nSequenceID, pComponent, username, database, systemModel) else: raise Exception("Unknown component type: " + pComponent["componenttype"])
def createFromComponent(nSequenceID, pComponent, username, database, systemModel=None): if pComponent["componenttype"] == Cassette.componentType: return Cassette.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Add.componentType: return Add.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Evaporate.componentType: return Evaporate.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Transfer.componentType: return Transfer.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == React.componentType: return React.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Prompt.componentType: return Prompt.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Install.componentType: return Install.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Comment.componentType: return Comment.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == TrapF18.componentType: return TrapF18.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == EluteF18.componentType: return EluteF18.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Initialize.componentType: return Initialize.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Mix.componentType: return Mix.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Move.componentType: return Move.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == Summary.componentType: return Summary.createFromComponent(nSequenceID, pComponent, username, database, systemModel) elif pComponent["componenttype"] == ExternalAdd.componentType: return ExternalAdd.createFromComponent(nSequenceID, pComponent, username, database, systemModel) else: raise Exception("Unknown component type: " + pComponent["componenttype"])
def install(self, url, targetPath, key=None, ui=None): """Install the file located in the url given. Args: url (str): The url to download the package to install. targetPath (str): Where to install the package. key (str): If the system needs a key to access. Defaults to None. ui (InstallatorUI): User Interface connection. Defaults to None. """ if ui: ui.progressText.append('Starting downloading files...') download = Download.Download(url, key, ui=ui) download.download() downloadedPath = download.getExtractedPath( ) or download.getFileDownloaded() if ui: ui.progressText.append('Installing the files...') install = Install.Install(downloadedPath, targetPath, ui=ui) install.install() if ui: ui.progressText.append('Installation successful') ui.progressBar.setValue(100)
def do_install(): """ Do the UI for the install. This will either return, or raise an exception. DialogEscape means that the installer should start over. If we have any command-line arguments, let's handle them now """ arg_parser = argparse.ArgumentParser(description=Title(), prog="Installer") arg_parser.register('type', 'bool', lambda x: x.lower() in ["yes", "y", "true", "t"]) arg_parser.add_argument('-p', '--project', dest='project', default=Project(), help="Specify project (default {})".format( Project())) arg_parser.add_argument('-T', '--train', dest="train", help="Specify train name") arg_parser.add_argument('-U', '--url', dest="url", help="URL to use when fetching files") arg_parser.add_argument('-M', '--manifest', dest='manifest', help="Path to manifest file") arg_parser.add_argument('-P', '--packages', dest='package_dir', help='Path to package files') arg_parser.add_argument( "-B", "--trampoline", dest='trampoline', default=True, type='bool', help="Run post-install scripts on reboot (default)") args = arg_parser.parse_args() if args: LogIt("Command line args: {}".format(args)) SetProject(args.project) if validate_system() is False: Dialog.MessagdeBox( Title(), "\nSystem memory is too small. Minimum memory size is 8Gbytes", height=10, width=45).run() return if args.manifest: if os.path.exists(args.manifest): manifest_path = args.manifest else: Dialog.MessageBox( Title(), "A manifest file was specified on the command line, but does not exist. The manifest file specified was\n\n\t{}" .format(args.manifest), height=15, width=45).run() raise InstallationError( "Command-line manifest file {} does not exist".foramt( args.manifet)) else: manifest_path = "/.mount/{}-MANIFEST".format(Project()) if not os.path.exists(manifest_path): manifest_path = None package_dir = args.package_dir or "/.mount/{}/Packages".format(Project()) if not os.path.exists(package_dir): # This will be used later to see if we should try downloading package_dir = None # If we aren't given a URL, we can try to use the default url. # If we have a manifest file, we can figure out train; # if we don't have a train or manifest file, we're not okay. if (not manifest_path and not args.train): LogIt("Command-line URL {}, train {}, manifest {}".format( args.url, args.train, manifest_path)) box = Dialog.MessageBox(Title(), "", height=15, width=45) box.text = "Neither a manifest file nor train were specified" box.run() raise InstallationError("Incorrect command-line arguments given") conf = Configuration.SystemConfiguration() if conf is None: raise RuntimeError("No configuration?!") # Okay, if we're going to have to download, let's make an update server object if args.url: temp_update_server = Configuration.UpdateServer( name="Installer Server", url=args.url, signing=False) # This is SO cheating # It can't write to the file, but it does that after setting it. try: conf.AddUpdateServer(temp_update_server) except: pass conf.SetUpdateServer("Installer Server", save=False) # If we have a train, and no manifest file, let's grab one if manifest_path: manifest = Manifest.Manifest() try: manifest.LoadPath(manifest_path) except: manifest = None else: manifest = None if args.train and not manifest: try: status = Dialog.MessageBox( Title(), "Attempting to download manifest for train {}".format( args.train), height=15, width=30, wait=False) status.clear() status.run() except: pass try: manifest = conf.FindLatestManifest(train=args.train, require_signature=False) except: manifest = None # At this point, if we don't have a manifest, we can't do anything if manifest is None: LogIt("Could not load a manifest") text = "Despite valiant efforts, no manifest file could be located." Dialog.MessageBox(Title(), text, height=15, width=30).run() raise InstallationError("Unable to locate a manifest file") LogIt("Manifest: Version {}, Train {}, Sequence {}".format( manifest.Version(), manifest.Train(), manifest.Sequence())) do_upgrade = False boot_method = None disks = SelectDisks() if not disks: try: Dialog.MessageBox(Title(), "No suitable disks were found for installation", height=15, width=60).run() except: pass raise InstallationError("No disks selected for installation") if found_bootpool: if UpgradePossible(): text = """The {} installer can upgrade the existing {} installation. Do you want to upgrade?""".format(Project(), Project()) yesno = Dialog.YesNo("Perform Upgrade", text, height=12, width=60, yes_label="Upgrade", no_label="Do not Upgrade", default=True) do_upgrade = yesno.result else: Dialog.MessageBox("No upgrade possible", "").run() format_disks = True if found_bootpool: # If the selected disks are not the same as the existing boot-pool # disks, then we _will_ be formatting, and do not ask this question. disk_set = set([x.name for x in disks]) pool_set = set([Utils.Disk(x).name for x in found_bootpool.disks]) LogIt("disk_set = {}, pool_set = {}".format(disk_set, pool_set)) if pool_set == disk_set: yesno = Dialog.YesNo( Title(), "The {} installer can reformat the disk{}, or create a new boot environment.\nReformatting will erase all of your data" .format(Project(), "s" if len(disks) > 1 else ""), height=10, width=60, yes_label="Re-format", no_label="Create New BE", default=True) format_disks = yesno.result yesno.clear() if format_disks: # If there is already a freenas-boot, and we're not using all of # the disks in it, then this will cause problems. # If we made it this far, there is only one freenas-boot pool. if found_bootpool: pool_disks = [Utils.Disk(x) for x in found_bootpool.disks] disk_set = set([x.name for x in disks]) pool_set = set([x.name for x in pool_disks]) LogIt("disk_set = {}, pool_set = {}".format(disk_set, pool_set)) if not pool_set <= disk_set: # This means there would be two freenas-boot pools, which # is too much of a problem. yesno = Dialog.YesNo( Title(), "The existing boot pool contains disks that are not in the selected set of disks, which would result in errors. Select Start Over, or press Escape, otherwise the {} installer will destroy the existing pool" .format(Project()), width=60, yes_label="Destroy Pool", no_label="Start over", default=False) yesno.prompt += "\nSelected Disks: " + " ,".join( sorted([x.name for x in disks])) yesno.prompt += "\nPool Disks: " + " ,".join( sorted([x.name for x in pool_disks])) if yesno.result is False: raise Dialog.DialogEscape current_method = BootMethod() yesno = Dialog.YesNo( "Boot Method", "{} can boot via BIOS or (U)EFI. Selecting the wrong method can result in a non-bootable system" .format(Project()), height=10, width=60, yes_label="BIOS", no_label="(U)EFI", default=False if current_method == "efi" else True) if yesno.result is True: boot_method = "bios" else: boot_method = "efi" if not do_upgrade: # Ask for root password while True: password_fields = [ Dialog.FormItem( Dialog.FormLabel("Password:"******"", width=20, maximum_input=50, hidden=True)), Dialog.FormItem( Dialog.FormLabel("Confirm Password:"******"", width=20, maximum_input=50, hidden=True)), ] try: password_input = Dialog.Form( "Root Password", "Enter the root password. (Escape to quit, or select No Password)", width=60, height=15, cancel_label="No Password", form_height=10, form_items=password_fields) results = password_input.result if results and results[0].value.value != results[1].value.value: Dialog.MessageBox("Password Error", "Passwords did not match", width=35, ok_label="Try again").run() continue else: new_password = results[0].value.value if results else None break except Dialog.DialogEscape: try: Diallog.MessageBox("No Password Selected", "You have selected an empty password", height=7, width=35).run() except: pass new_password = None break # I'm not sure if this should be done here, or in Install() if package_dir is None: cache_dir = tempfile.mkdtemp() else: cache_dir = package_dir try: Utils.GetPackages(manifest, conf, cache_dir, interactive=True) except BaseException as e: LogIt("GetPackages raised an exception {}".format(str(e))) if package_dir is None: shutil.rmtree(cache_dir, ignore_errors=True) raise LogIt("Done getting packages?") # Let's confirm everything text = "The {} Installer will perform the following actions:\n\n".format( Project()) height = 10 if format_disks: text += "* The following disks will be reformatted, and all data lost:\n" height += 1 for disk in disks: text += "\t* {} {} ({}bytes)\n".format(disk.name, disk.description[:25], SmartSize(disk.size)) height += 1 if found_bootpool: text += "* The existing boot pool will be destroyed\n" height += 1 text += "* {} Booting\n".format( "BIOS" if boot_method is "bios" else "(U)EFI") else: text += "* A new Boot Environment will be created\n" height += 1 if do_upgrade: text += "* {} will be upgraded\n".format(Project()) else: text += "* {} will be freshly installed\n".format(Project()) height += 1 yesno.prompt = text yesno.default = False yesno = Dialog.YesNo("{} Installation Confirmation".format(Project()), text, height=height, width=60, yes_label="Continue", no_label="Cancel", default=False) if yesno.result == False: LogIt("Installation aborted at first confirmation") raise Dialog.DialogEscape if format_disks: yesno = Dialog.YesNo( "LAST CHANCE", "The {} installer will format the selected disks and all data on them will be erased.\n\nSelect Start Over or hit Escape to start over!" .format(Project()), height=10, width=50, yes_label="Continue", no_label="Start Over", default=False) if yesno.result is False: LogIt("Installation aborted at second confirmation") raise Dialog.DialogEscape # This may take a while, it turns out try: status = Dialog.MessageBox(Title(), "\nBeginning installation", height=7, width=25, wait=False) status.clear() status.run() except: pass # Okay, time to do the install with InstallationHandler() as handler: try: Install.Install( interactive=True, manifest=manifest, config=conf, package_directory=cache_dir, disks=disks if format_disks else None, efi=True if boot_method is "efi" else False, upgrade_from=found_bootpool if found_bootpool else None, upgrade=do_upgrade, package_handler=handler.start_package, progress_handler=handler.package_update, password=None if do_upgrade else new_password, trampoline=args.trampoline) except BaseException as e: LogIt("Install got exception {}".format(str(e))) raise return
def setUp(self): self.ti = Install() self.installHome = "C:/ibm/websphere7_64" self.noInstallHome = "C:/ibm/websphere7_64_XX" self.mediaHome = "O:/Internal IT/Software – Public/IBM/was_nd_7/wintel64/disk1/WAS"
class TestInstall(unittest.TestCase): logger = Logger.getLogger("Test") def setUp(self): self.ti = Install() self.installHome = "C:/ibm/websphere7_64" self.noInstallHome = "C:/ibm/websphere7_64_XX" self.mediaHome = "O:/Internal IT/Software – Public/IBM/was_nd_7/wintel64/disk1/WAS" def tearDown(self): if os.path.exists("%s/uninstall/uninstall.exe" % self.noInstallHome): self.logger.info("Cleaning up test WebSphere installation at: %s" % self.noInstallHome) os.system('%s/uninstall/uninstall -silent -OPT removeProfilesOnUninstall="true"' % self.noInstallHome) shutil.rmtree(self.noInstallHome) self.ti = None self.installHome = None self.noInstallHome = None self.mediaHome = None def testCheckExistingInstallDetected(self): '''testCheckExistingInstallDetected''' self.logger.info("TestInstall:testCheckExistingInstallDetected") self.isWebSphereInstalled = True self.assertEqual(self.isWebSphereInstalled, self.ti.isWebSphereInstalled(self.installHome)) def testCheckNonExistingInstallDetected(self): '''testCheckNonExistingInstallDetected''' self.logger.info("TestInstall:testCheckNonExistingInstallDetected") self.isWebSphereInstalled = False self.assertEqual(self.isWebSphereInstalled, self.ti.isWebSphereInstalled(self.noInstallHome)) def testNoInstallHomeException(self): '''testNoInstallHomeException''' self.logger.info("TestInstall:testNoInstallHomeException") try: self.ti.isWebSphereInstalled() except Exception: pass else: fail("Expected an Exception") def testNullInstallHomeDirException(self): '''testNullInstallHomeDirException''' self.logger.info("TestInstall:testNullInstallHomeDirException") try: self.ti.installWebSphereBase(mediaHome=self.mediaHome) except Exception: pass else: fail("Expected an Exception") def testNullMediaHomeDIR(self): '''testNullMediaHomeDIR''' self.logger.info("TestInstall:testNullMediaHomeDIR") try: self.ti.installWebSphereBase(installHome=self.installHome) except Exception: pass else: fail("Expected an Exception") def testInstallBase(self): '''testInstallBase''' self.logger.info("TestInstall:testInstallBase") self.isInstallSucess = True self.assertEquals(self.isInstallSucess, self.ti.installWebSphereBase(installHome=self.noInstallHome, mediaHome=self.mediaHome))
def __init__(self): Gtk.Window.__init__(self, title="Ignition") # system("mkdir ~/.local/share/ignition/") # self.appdata = home+"/.local/share/ignition/" self.set_wmclass("Ignition", "Ignition") self.set_icon_from_file('/home/josh/ignition/Armature.svg') installer = Install() tabs = Gtk.Notebook.new() tabsnames = [ "Basics", "Launchers", "Browsers", "Cloud", "Games", "Office", "Themes", "Media", "Toys", "Terminals", "Programming", "Media Production" ] basicsnames = [ "All Basics", "Neofetch", "Gdebi", "Redshift", "Gnome Tweaks", "Baobab", "WINE", "Safe Eyes", "Steamengine Locomotive" ] launchersnames = ["Synapse", "Plank", "ULauncher", "Cario"] browsersnames = [ "Chromium", "Chromium on APT", "Firefox", "Midori (Very Light)" ] cloudnames = ["Google Tools", "YakYak", "Gnome Gmail"] gamesnames = [ "Gnome Games App", "Steam", "Minecraft", "Gnome Games Suite", "Super Tux Kart", "Gnome Breakout" ] officenames = [ "Libreoffice", "OPENOFFICE Desktop Editors", "Abiword", "Gnumeric", "Google Tools", "microPad", "P3X Onenote", "Apache OpenOffice", "ProjectLibre" ] themesnames = [ "Papirus Icon Theme", "Pocillo Icon Theme", "Faenza Icon Theme", "Pling Store", "XScreenSaver" ] medianames = [ "VLC Media Player", "Rhythmbox", "Spotify", "PAVU Control", "GStreamer Codecs", "Gnome Image Viewer", "Totem", "Flash Player" ] toysnames = ["BB", "AA Lib"] terminalsnames = [ "Tilix", "Terminator", "Gnome Terminal", "Xfce Terminal", "LXTerminal", "XTerm", "MATE Terminal", "Konsole" ] programmingnames = [ "GIT SCM", "VS Code", "Atom", "Sublime", "Android Studio", "Eclipse", "Gedit", "Mousepad" ] mediaproductionnames = [ "GIMP Photo Editor", "Blender", "Inkscape", "Open Shot", "Kdenlive", "Krita", "Ubuntu Studio" ] gridlistlist = [ basicsnames, launchersnames, browsersnames, cloudnames, gamesnames, officenames, themesnames, medianames, toysnames, terminalsnames, programmingnames, mediaproductionnames ] allitems = [] # filler = Gtk.Button.new() allitemsmethods = [ "allbasics()", "neofetch()", "gdebi()", "redshift()", "gnometweaks()", "baobab()", "wine()", "safeeyes()", "sl()", "synapse()", "plank()", "ulauncher()", "cario()", "chromium()", "firefox()", "midori()", "googletools()", "yakyak()", "ggmail()", "ggamesapp()", "steam()", "minecraft()", "ggames()", "supertuxkart()", "gnomebreakout()", "libreofficeall()", "openofficedesktopeditors()", "abiword()", "gnumeric()", "googletools()", "micropad()", "p3xonenote()", "apacheopenoffice()", "projectlibre()", "papirus()", "pocillo()", "faenza()", "pling()", "xscreensaver()", "vlc()", "rhythmbox()", "spotify()", "pavucontrol()", "gstreamer()", "gimageviewer()", "totem()", "bb()", "aalibbin()", "tilix()", "terminator()", "gterminal()", "xfceterminal()", "lxterminal()", "xterm()", "mateterminal()", "konsole()", "git()", "code()", "atom()", "sublime()", "androidstudio()", "gedit()", "mousepad()", "eclipse()", "gimp()", "blender()", "inkscape()", "openshot()", "kdenlive()", "krita()", "ubuntustudio()" ] for gridlist in gridlistlist: for item in gridlist: allitems.append(item) # print(allitems) # allitems = sorted(allitems) allitems.sort() # print(allitemsmethods) #print(allitems) k = 0 installapps = self.get_methods(installer) installapps.sort() #print(installapps) prevbutton = [] for gridlist in gridlistlist: name = tabsnames[k] tabgrid = name tabgrid = Gtk.Grid.new() # print(gridlist) row = 0 col = 0 for item in gridlist: # allitemmethod = allitemsmethods[k] button = Gtk.Button.new() button.set_label(item) # button.connect("clicked", installer.allitemmethod) if col == 0: # print("Attach") tabgrid.attach(button, col, row, 2, 1) else: # print("Attach Next To") tabgrid.attach_next_to(button, prevbutton, Gtk.PositionType.RIGHT, 2, 1) prevbutton = button if col >= 7: row = row + 1 col = 0 else: col = col + 1 tabs.insert_page(tabgrid, Gtk.Label.new(name), -1) k = k + 1 self.add(tabs)
print() eingabe = get_input() if eingabe is not None and not eingabe == "": command = eingabe.split() operator = command[0].lower() packages = command[1:] if "install" == operator.lower(): print() for i in packages: Install.install_mod(i, str(Install.getModData(i, csv_file, 7)), m.directory, csv_list), elif "update" == operator.lower(): # TODO Check if working m.get_update() elif "uninstall" == operator.lower(): Uninstall.uninstall("ccl", m.directory) elif "upgrade" == operator.lower(): Install.updateMods(csv_list, m.directory) elif "help" == operator.lower(): print("WORKING")
import sys sys.path.append('E:/Projects/MonkeyTest/smartTree') from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice from com.android.monkeyrunner.easy import EasyMonkeyDevice, By import Install, Monkey, Login, Logout, OpenClose # Connect device device = MonkeyRunner.waitForConnection() if not device: print("Please connect a device to start!") else: print("Device Connected successfully!") # Install Install.Install(device) # open and close OpenClose.OpenClose(device) # Easy Device init easymonkeydevice object ,this is init method print('init easymonkeydevice') edevice = EasyMonkeyDevice(device) # # Launch Interval # MonkeyRunner.sleep(1) # Login:student monkeytest Logout Login.Student_In(device, edevice) Monkey.MonkeyTest(device, edevice) Logout.Logout(device, edevice)
# email: [email protected] # www: http://www.openwns.org # _____________________________________________________________________________ # # openWNS is free software; you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License version 2 as published by the # Free Software Foundation; # # openWNS is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import wnsbase.playground.Core import Install core = wnsbase.playground.Core.getCore() if not core.hasPlugin("Install"): core.registerPlugin("Install") installCommand = Install.InstallCommand() core.registerCommand(installCommand)