Ejemplo n.º 1
0
 private void PerformDeploy([NotNull] string targetDir)
 {
     using (var manager = new MaintenanceManager(targetDir, Handler, _machineWide, _portable))
     {
         Log.Info($"Deploying Zero Install from '{Locations.InstallBase}' to '{targetDir}'");
         manager.Deploy();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Deploys a Zero Install instance to this machine.
        /// </summary>
        /// <param name="machineWide"><c>true</c> to deploy to a location for all users; <c>false</c> to deploy to a location for the current user only.</param>
        /// <returns>The director Zero Install was deployed to.</returns>
        private string DeployInstance(bool machineWide)
        {
            string programFiles = machineWide
                ? Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
                : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Programs");
            string installLocation = Path.Combine(programFiles, "Zero Install");

            Log.Info("Deploying Zero Install to " + installLocation);
            using (var manager = new MaintenanceManager(installLocation, Handler, machineWide, portable: false))
                manager.Deploy();
            Log.Warn(Resources.Added0installToPath + Environment.NewLine + Resources.ReopenTerminal);

            return(installLocation);
        }
Ejemplo n.º 3
0
            /// <summary>
            /// Deploys a portable copy of Zero Install to a temp directory and delegates the actual removal of the current instance to this copy.
            /// </summary>
            private void DelegateToTempCopy()
            {
                string tempDir = FileUtils.GetTempDirectory("0install-remove");

                using (var manager = new MaintenanceManager(tempDir, Handler, machineWide: false, portable: true))
                    manager.Deploy();

                string assembly = Path.Combine(tempDir, ProgramUtils.GuiAssemblyName ?? "0install");

                var args = new[] { MaintenanceMan.Name, RemoveHelper.Name, Locations.InstallBase };

                if (Handler.Verbosity == Verbosity.Batch)
                {
                    args = args.Append("--batch");
                }
                if (Handler.Background)
                {
                    args = args.Append("--background");
                }

                ProcessUtils.Assembly(assembly, args).Start();
            }