コード例 #1
0
        override protected void PreInstallation(CStatusWindow sw)
        {
            string tarParams = "";

            client = new GConf.Client();

            LocalThemeFile = config.ThemesPath + Path.GetFileName(DownloadUrl);
            string InstallThemeFile = config.ApplicationInstallPath + Path.GetFileName(DownloadUrl);

            tarParams    = CUtility.GetTarParams(Path.GetExtension(DownloadUrl));
            sw.Mainlabel = Catalog.GetString(CConfiguration.txtDownloadTheme);
            //Herunterladen
            if (!File.Exists(InstallThemeFile))
            {
                GetThemeFile(sw);
            }
            sw.SetProgress("1/" + installationSteps);
            //Entpacken
            sw.Mainlabel = Catalog.GetString(CConfiguration.txtExtracting);
            Console.WriteLine("Command: tar" + tarParams + LocalThemeFile + " -C " + config.ApplicationInstallPath);
            ConOutp = CUtility.Execute("tar", tarParams + LocalThemeFile + " -C " + config.ApplicationInstallPath);
            sw.SetProgress("2/" + installationSteps);
            //Sichern
            sw.Mainlabel             = Catalog.GetString(CConfiguration.txtSavingForRestore);
            previousApplicationTheme = (string)client.Get(GConfApplicationKey);
            sw.SetProgress("3/" + installationSteps);
        }
コード例 #2
0
        override protected void PreInstallation(CStatusWindow sw)
        {
            gdmConfAvailable       = File.Exists(gdmconf);
            gdmConfCustomAvailable = File.Exists(gdmconfcustom);
            if (!gdmConfAvailable)
            {
                throw new Exception(Catalog.GetString("Installation is not possible!") + "-" + Catalog.GetString(String.Format("No {0} available", gdmconf)));
            }
            if (!installationIsPossible)
            {
                throw new Exception(Catalog.GetString("Installation is not possible!") + "-" + Catalog.GetString("Only GDM is supported"));
            }

            //TODO: grep ersetzen durch IniWorker
            sb = CUtility.Execute("grep", "GraphicalThemeRand= " + gdmconf);
            if (sb.Length < 1)
            {
                Console.WriteLine("Warning:grep returned no GraphicalThemeRand-Entry\"");
                randomThemeActive = false;
            }
            else
            {
                randomThemeActive = bool.Parse(sb.ToString().Split('=')[1]);
            }

            //Falls nicht vorhanden wird sie erzeugt
            if (!gdmConfCustomAvailable)
            {
                try{
                    FileStream fs = File.Create(gdmconfcustomtemp);
                    fs.Close();
                    CUtility.ExecuteSu(config, "mv " + gdmconfcustomtemp + " " + gdmconfcustom);
                }
                catch { throw new Exception("Gdm.conf-custom couldn't be created, aborting!"); }
            }
            sw.SetProgress("1/" + installationSteps);
            //Datei einlesen
            iworker = new CIniWorker(gdmconfcustom);
            iworker.CreateSections("daemon;security;xdmcp;gui;greeter;chooser;debug;servers", ';');
            //Entpackparameter
            tarParams = @"tar " + CUtility.GetTarParams(DownloadUrl);
            //Herunterladen
            GetThemeFile(sw);
            sw.SetProgress("2/" + installationSteps);
            //Entpacken
            sw.Mainlabel = CConfiguration.txtExtracting;
            sb           = CUtility.ExecuteSu(config, @tarParams + @LocalThemeFile + " -C " + @config.GdmInstallPath);
            FolderName   = sb.ToString().Split('/');
            if (FolderName[0] == "")
            {
                throw new Exception(Catalog.GetString("Couldn't get any usefull information from the tar-command...aborting"));
            }
            //Console.WriteLine(FolderName[0]);
            sw.SetProgress("3/" + installationSteps);
        }