+ if (FileExists(FName) == true)
+ Res &= ReadConfigFile(Cnf,FName);
+
+ if (Res == false)
+ return false;
+
+ if (Cnf.FindB("Debug::pkgInitConfig",false) == true)
+ Cnf.Dump();
+
+#ifdef APT_DOMAIN
+ if (Cnf.Exists("Dir::Locale"))
+ {
+ bindtextdomain(APT_DOMAIN,Cnf.FindDir("Dir::Locale").c_str());
+ bindtextdomain(textdomain(0),Cnf.FindDir("Dir::Locale").c_str());
+ }
+#endif
+
+ // Translation
+ Cnf.Set("APT::Acquire::Translation", "environment");
+
+ return true;
+}
+ /*}}}*/
+// pkgInitSystem - Initialize the _system calss /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool pkgInitSystem(Configuration &Cnf,pkgSystem *&Sys)
+{
+ Sys = 0;
+ string Label = Cnf.Find("Apt::System","");
+ if (Label.empty() == false)
+ {
+ Sys = pkgSystem::GetSystem(Label.c_str());
+ if (Sys == 0)
+ return _error->Error(_("Packaging system '%s' is not supported"),Label.c_str());
+ }
+ else
+ {
+ signed MaxScore = 0;
+ for (unsigned I = 0; I != pkgSystem::GlobalListLen; I++)
+ {
+ signed Score = pkgSystem::GlobalList[I]->Score(Cnf);
+ if (Score > MaxScore)
+ {
+ MaxScore = Score;
+ Sys = pkgSystem::GlobalList[I];
+ }
+ }
+
+ if (Sys == 0)
+ return _error->Error(_("Unable to determine a suitable packaging system type"));
+ }
+
+ return Sys->Initialize(Cnf);