Exemplo n.º 1
0
        /// <summary>
        /// public static void p2p_logs_config(string sname)
        /// Config logging optiond for Subutai Social P2P service
        /// </summary>
        /// <param name="serviceName">Name of service to be installed</param>
        public static void p2p_logs_config(string serviceName)
        {
            string logPath = FD.logDir();

            logPath = Path.Combine(logPath, "p2p_log.txt");
            logger.Info("Logs are in {0}", logPath);
            //Create Registry keys for parameters
            string sPath  = $"System\\CurrentControlSet\\Services\\{serviceName}\\Parameters";
            string ksPath = $"HKEY_LOCAL_MACHINE\\{sPath}";

            logger.Info("Registry key", sPath);
            RegistryKey kPath = Registry.LocalMachine.OpenSubKey(sPath);

            if (kPath != null)
            {
                //Path to logs
                Registry.SetValue(ksPath, "AppStdout", logPath, RegistryValueKind.ExpandString);
                logger.Info("AppStdout: {0}", logPath);
                Registry.SetValue(ksPath, "AppStderr", logPath, RegistryValueKind.ExpandString);
                logger.Info("AppStderr: {0}", logPath);
                //Logs rotation
                //kPath.SetValue("AppRotateSeconds", 86400, RegistryValueKind.DWord);
                //Registry.SetValue(sPath, "AppRotateSeconds", filepath, RegistryValueKind.ExpandString);
                int maxBytes = 50 * 1024;//
                Registry.SetValue(ksPath, "AppRotate", maxBytes, RegistryValueKind.ExpandString);
                logger.Info("AppRotateBytes: {0}", maxBytes);
                kPath.Close();
            }
        }
Exemplo n.º 2
0
        public static string installation_type = "";                                                   //installation type

        /// <summary>
        ///  public static void download_repo()
        ///  Downloading nesessary files from kurjun(gorjun) repository accorfing to download list
        /// </summary>
        public static void download_repo()
        {
            Deploy.StageReporter("Downloading prerequisites", "");

            logger.Info("Downloading repo_descriptor");
            download_description_file("repo_descriptor");
            installation_type = _arguments["type"];

            Deploy.StageReporter("", $"Creating download list for installation type: {installation_type}");

            rows = FD.repo_rows($"{Program.inst_Dir}{_arguments["repo_descriptor"]}", _arguments["peer"], installation_type);
            string regfile = Path.Combine(FD.logDir(), "subutai-clean-registry.reg");

            Deploy.HideMarquee();
            download_file(regfile, download_prerequisites);
        }
Exemplo n.º 3
0
        /// <summary>
        /// private void f_install_Load(object sender, EventArgs e)
        /// On form load: Changes environment variables - %Path% and %Subutai%
        /// updates uninstall string (in Windows Registry)
        /// and starts downloading
        /// </summary>
        private void f_install_Load(object sender, EventArgs e)
        {
            _deploy.SetEnvironmentVariables();
            Inst.remove_repo_desc(Program.inst_Dir, _arguments["repo_descriptor"]);

            string strUninstall = "";

            if (!FD.copy_uninstall())
            {
                strUninstall = Path.Combine(Program.inst_Dir, "bin", "uninstall-clean.exe");
            }
            else
            {
                strUninstall = Path.Combine(FD.logDir(), "uninstall-clean.exe");
            };

            Inst.update_uninstallString(strUninstall);

            string res = FD.delete_dir_bin(Program.inst_Dir);

            if (!res.Contains("Deleted"))
            {
                MessageBox.Show(res, "Delete bin folder", MessageBoxButtons.OK);
                res = FD.delete_dir_bin(Program.inst_Dir);
                if (!res.Contains("Deleted"))
                {
                    Program.ShowError("Can not delete bin folder.\nPlease, close running applications (Subutay tray, cmd sessions, file explorer) that can lock files \nand install again", "Delete bin folder");
                    Program.form1.Visible = false;
                }
            }

            if (_arguments["network-installation"].ToLower() == "true")
            {
                // DOWNLOAD REPO
                Deploy.StageReporter("Downloading prerequisites", "");
                Deploy.HideMarquee();
                TC.download_repo();
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Runs uninstall application
 /// </summary>
 /// <param name="appdir">The appdir - installation folder</param>
 private void clean(string appdir)
 {
     Process.Start($"{FD.logDir()}\\{Deploy.SubutaiUninstallName}", "Silent false NoAll");
 }
Exemplo n.º 5
0
        /// <summary>
        /// Creates all shortcuts needed.
        /// </summary>
        public void createAppShortCuts(bool forAll)
        {
            logger.Info("Creating shortcuts");
            var    binPath  = "";
            var    destPath = "";
            string iconPath = "";

            if (forAll)
            {
                //Creating tray shortcuts
                binPath  = Path.Combine(Program.inst_Dir, "bin\\tray", SubutaiTrayName);
                destPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory),
                                        "Subutai.lnk");


                //Desktop
                iconPath = Path.Combine(Program.inst_Dir, SubutaiIconName);
                Deploy.CreateShortcut(
                    binPath,
                    destPath,
                    "",
                    iconPath,
                    false);

                //StartMenu/Programs
                destPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu),
                                        "Programs",
                                        "Subutai.lnk");
                Deploy.CreateShortcut(
                    binPath,
                    destPath,
                    "",
                    iconPath,
                    false);
            }

            //Create App folder in Programs
            string folderpath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonPrograms), "Subutai");

            try
            {
                if (!Directory.Exists(folderpath))
                {
                    Directory.CreateDirectory(folderpath);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }

            if (forAll)
            {
                //Shortcut in Subutai folder for SubutaiTray
                destPath = Path.Combine(folderpath, "Subutai.lnk");
                Deploy.CreateShortcut(
                    binPath,
                    destPath,
                    "",
                    iconPath,
                    false);
            }

            //Shortcut in Subutai folder for Uninstall
            destPath = Path.Combine(folderpath, "Uninstall.lnk");
            binPath  = Path.Combine(FD.logDir(), SubutaiUninstallName);
            iconPath = Path.Combine(Program.inst_Dir, SubutaiUninstallIconName);
            Deploy.CreateShortcut(
                binPath,
                destPath,
                "",
                iconPath,
                false);
        }