+// 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 system type"));
+ }
+
+ return Sys->Initialize(Cnf);
+}
+ /*}}}*/