Exemple #1
0
        private void Install(AuthoredPackage pkg, AuthoredInstallEnvironment environ)
        {
            if (!pkg.Selected)
            {
                return;
            }

            foreach (IPackage subPkg in pkg.SubPackages)
            {
                environ.Package = subPkg;
                Install(subPkg as AuthoredPackage, environ);
            }

            // Console.Out.WriteLine(">> PreInstallCheck: {0}", pkg.Name);
            ExecuteCommands(pkg.PreInstallCheck, environ);
            // Console.Out.WriteLine(">> Installation: {0}", pkg.Name);
            ExecuteCommands(pkg.Installation, environ);
            // FIXME: We only allow this for the BaseSystem pkg
            AssureInitialized();
            if (myRoot == null)
            {
                throw new ServiceNotReadyException();
            }

            // ... write the recipt ...
            myRoot.Create <IPackage>(pkg.Id.ToString(), StreamOptions.SingleObject | StreamOptions.AllowDerivedTypes).Object = pkg;
            installedPackages.Add(pkg);

            // DebugFS();
        }
Exemple #2
0
        private void ExecuteCommands(List <ICommand> list, AuthoredInstallEnvironment environ)
        {
            // Console.Out.WriteLine("\tExecute: {0} commands", list.Count);

            environ.CommandsToExecute = new List <ICommand>(list);
            foreach (ICommand cmd in list)
            {
                // Console.Out.WriteLine("\t\tExecuting: {0}", cmd.GetType().Name);
                environ.CommandsToExecute.RemoveAt(0);
                cmd.Execute(environ);

                // DebugFS();
            }
        }
        internal AuthoredInstallEnvironment Clone()
        {
            AuthoredInstallEnvironment clone =
                componentEnvironment.ConfigureInlineComponent(cloneComponentDefinition) as AuthoredInstallEnvironment;

            clone.SourcePath      = SourcePath;
            clone.DestinationPath = DestinationPath;

            clone.commandsToExecute    = new List <ICommand>(commandsToExecute);
            clone.destinationFileLists = new Dictionary <string, List <InstallDestination> >(destinationFileLists);
            clone.sourceFileLists      = new Dictionary <string, List <InstallSource> >(sourceFileLists);

            return(clone);
        }
Exemple #4
0
        public void Uninstall(AuthoredPackage pkg, AuthoredInstallEnvironment environ)
        {
            if (!pkg.Selected)
            {
                return;
            }

            foreach (IPackage subPkg in pkg.SubPackages)
            {
                Uninstall(subPkg as AuthoredPackage, environ);
            }

            ExecuteCommands(pkg.PreUninstallCheck, environ);
            ExecuteCommands(pkg.Uninstallation, environ);
            AssureInitialized();
            if (myRoot == null)
            {
                throw new ServiceNotReadyException();
            }
            myRoot.Delete(pkg.Id.ToString());
            installedPackages.RemoveAll(delegate(IPackage xpkg) { return(xpkg.Id == pkg.Id); });
        }