Ejemplo n.º 1
0
        private static void Install(InstallerOptions opts)
        {
            var env = EnvironmentManager.Get(opts.Environment);

            if (env == null)
            {
                Console.WriteLine(
                    "you must create an environment first - try dyndle help add-environment");
                return;
            }
            CoreserviceClientFactory.SetEnvironment(env);

            var module = new Installer.Installer(opts);

            var output = module.Run();

            Console.WriteLine(output);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Arguments"/> class.
        /// </summary>
        /// <param name="console">The console.</param>
        /// <param name="args">The arguments.</param>
        public Arguments(UiConsole console, string[] args)
        {
            this.Console = console;
            if (this.ParseShowHelp(args))
            {
                this.ShowHelp();
            }
            else
            {
                this.Package = this.ParsePackageUri(args);
                this.Options = this.ParseInstallerOptions(args);

                if (this.Options == null || string.IsNullOrEmpty(this.Package))
                {
                    this.ShowHelp();
                }
            }
        }
        public InstallerFrontend(InstallerOptions options = InstallerOptions.None)
        {
            var settings = Settings.Instance;

            if (settings.SkipVersionChecks)
            {
                Options |= InstallerOptions.SkipVersionChecks;
            }
            if (settings.ForceHTTP)
            {
                Options |= InstallerOptions.HTTP;
            }
            if (settings.LeavePatchDLLs)
            {
                Options |= InstallerOptions.LeavePatchDLLs;
            }
            if (settings.ForceBackup)
            {
                Options |= InstallerOptions.ForceBackup;
            }
            if (settings.Offline)
            {
                Options |= InstallerOptions.Offline;
            }
            Options |= options;

            _Downloader = new Downloader(force_http: Options.HasFlag(InstallerOptions.HTTP), offline: Options.HasFlag(InstallerOptions.Offline));
            _Installer  = new Installer(_Downloader, exe_path: null);

            var cache_dir   = Path.Combine(Settings.SettingsDir, "Unity");
            var sevenz_path = Settings.Instance.SevenZipPath;

            _DebugConverter = new DebugConverter(cache_dir, _Installer, sevenz_path);

            Environment.SetEnvironmentVariable("MONOMOD_DEBUG_FORMAT", "MDB");

            foreach (var ent in settings.CustomComponentFiles)
            {
                LoadComponentsFile(ent);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Parses the installer options.
        /// </summary>
        /// <param name="args">The arguments.</param>
        /// <returns></returns>
        private InstallerOptions ParseInstallerOptions(string[] args)
        {
            var host = FindOptionValue(args, 0, "-h", "-host");

            if (string.IsNullOrEmpty(host))
            {
                this.Console.Events.RaiseOutputRequired("The sitecore host was not spesified." + Environment.NewLine + "Use -h or -host parameter to specify Sitecore host name", MessageLevel.Error);
                return(null);
            }

            var user     = FindOptionValue(args, 2, "-u", "-user") ?? defaultUserName;
            var password = FindOptionValue(args, 2, "-pw", "-password") ?? defaultPasswrod;

            var credentials = new NetworkCredential(user, password);

            var options = new InstallerOptions(host, credentials);

            if (FindOptionValue(args, int.MaxValue, "-s", "-silent") == "false")
            {
                options.Silent = false;
            }
            return(options);
        }
Ejemplo n.º 5
0
        static void Install(bool install, InstallerOptions options)
        {
            var spi = new ServiceProcessInstaller();
            var si = new ServiceInstaller();
            spi.Account = ServiceAccount.NetworkService;
            if (options != null && options.IsUser)
            {
                spi.Account = ServiceAccount.User;
                if (options.UserName != null)
                {
                    spi.Username = options.UserName;
                }
                if (options.Password != null)
                {
                    spi.Password = options.Password;
                }
            }
            si.StartType = ServiceStartMode.Automatic;
            si.ServiceName = "CloudBackup";
            si.DisplayName = "Cloud Backup Service";
            si.Description = "Schedules, run and manage cloud backup";
            si.Parent = spi;

            string path = Assembly.GetEntryAssembly().Location;
            Console.WriteLine("Location : " + path);

            var ic = new InstallContext();
            ic.Parameters.Add("assemblypath", path);
            si.Context = ic;
            spi.Context = ic;

            IDictionary rb = install ? new Hashtable() : null;
            try
            {
                Console.WriteLine("Starting Default Installation");
                if (install)
                {
                    si.Install(rb);
                }
                else
                {
                    si.Uninstall(rb);
                }
            }
            catch (Exception ex)
            {
                log.Fatal(ex);
                if (rb != null)
                {
                    Console.WriteLine("Rollback Default Installation");
                    IDictionary rbc = rb;
                    rb = null;
                    si.Rollback(rbc);
                }
            }
            finally
            {
                if (rb != null)
                {
                    Console.WriteLine("Commit Default Installation");
                    si.Commit(rb);
                }
            }
        }
Ejemplo n.º 6
0
 internal static InstallerOptions Parse(string[] args)
 {
     var options = new InstallerOptions();
     for (int index = 0; index < args.Length; index++)
     {
         if (String.Compare(args[index], "-username", StringComparison.OrdinalIgnoreCase) == 0)
         {
             options.IsUser = true;
             options.UserName = args[++index];
         }
         else if (String.Compare(args[index], "-password", StringComparison.OrdinalIgnoreCase) == 0)
         {
             options.IsUser = true;
             options.Password = args[++index];
         }
     }
     return options;
 }