]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/init.cc
Fixed version compare glitch
[apt.git] / apt-pkg / init.cc
index 27353c8789b8ec6d0c6ac631fe654d1433371c90..29926b97a5a36766878561f0b365ec58402d9d5f 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: init.cc,v 1.6 1998/09/26 05:34:19 jgg Exp $
+// $Id: init.cc,v 1.14 1998/11/25 23:54:06 jgg Exp $
 /* ######################################################################
 
    Init - Initialize the package library
@@ -9,9 +9,8 @@
                                                                        /*}}}*/
 // Include files                                                       /*{{{*/
 #include <apt-pkg/init.h>
-
-#include <sys/stat.h>
-#include <unistd.h>
+#include <apt-pkg/fileutl.h>
+#include <config.h>
                                                                        /*}}}*/
 
 // pkgInitialize - Initialize the configuration class                  /*{{{*/
@@ -22,7 +21,7 @@
 bool pkgInitialize(Configuration &Cnf)
 {
    // General APT things
-   Cnf.Set("APT::Architecture","i386");
+   Cnf.Set("APT::Architecture",ARCHITECTURE);
 
    // State
    Cnf.Set("Dir::State","/var/state/apt/");
@@ -34,9 +33,10 @@ bool pkgInitialize(Configuration &Cnf)
    Cnf.Set("Dir::State::xstatus","xstatus");
    Cnf.Set("Dir::State::userstatus","status.user");   
    Cnf.Set("Dir::State::status","/var/lib/dpkg/status");
+   Cnf.Set("Dir::State::cdroms","cdroms.list");
    
    // Cache
-   Cnf.Set("Dir::Cache","/tmp/");
+   Cnf.Set("Dir::Cache","/var/cache/apt/");
    Cnf.Set("Dir::Cache::archives","archives/");
    Cnf.Set("Dir::Cache::srcpkgcache","srcpkgcache.bin");
    Cnf.Set("Dir::Cache::pkgcache","pkgcache.bin");
@@ -45,12 +45,26 @@ bool pkgInitialize(Configuration &Cnf)
    Cnf.Set("Dir::Etc","/etc/apt/");
    Cnf.Set("Dir::Etc::sourcelist","sources.list");
    Cnf.Set("Dir::Etc::main","apt.conf");
-
+   Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods");
+   Cnf.Set("Dir::Bin::dpkg","/usr/bin/dpkg");
+   
    // Read the main config file
-   string FName = Cnf.FindDir("Dir::Etc::main");
-   struct stat Buf;   
-   if (stat(FName.c_str(),&Buf) != 0)
-      return true;
-   return ReadConfigFile(Cnf,FName);
+   string FName = Cnf.FindFile("Dir::Etc::main");
+   bool Res = true;
+   if (FileExists(FName) == true)
+      Res &= ReadConfigFile(Cnf,FName);
+   
+   // Read an alternate config file
+   const char *Cfg = getenv("APT_CONFIG");
+   if (Cfg != 0 && FileExists(Cfg) == true)
+      Res &= ReadConfigFile(Cnf,Cfg);
+   
+   if (Res == false)
+      return false;
+   
+   if (Cnf.FindB("Debug::pkgInitialize",false) == true)
+      Cnf.Dump();
+      
+   return true;
 }
                                                                        /*}}}*/