Beispiel #1
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);
        }
        protected override 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 "[email protected]);
            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);
        }