]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/init.cc
Working acquire code
[apt.git] / apt-pkg / init.cc
index e171d2c6cb55b827efcc6a16d6d758ff0ca387fa..f79668c543617e32ce939f1ec7daa5e125de19d7 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: init.cc,v 1.5 1998/09/22 05:30:24 jgg Exp $
+// $Id: init.cc,v 1.10 1998/11/05 07:21:42 jgg Exp $
 /* ######################################################################
 
    Init - Initialize the package library
@@ -9,6 +9,7 @@
                                                                        /*}}}*/
 // Include files                                                       /*{{{*/
 #include <apt-pkg/init.h>
+#include <config.h>
 
 #include <sys/stat.h>
 #include <unistd.h>
@@ -22,7 +23,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/");
@@ -36,21 +37,34 @@ bool pkgInitialize(Configuration &Cnf)
    Cnf.Set("Dir::State::status","/var/lib/dpkg/status");
    
    // 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");
-   Cnf.Set("Dir::Cache::pkgcache","pkgcache");
+   Cnf.Set("Dir::Cache::srcpkgcache","srcpkgcache.bin");
+   Cnf.Set("Dir::Cache::pkgcache","pkgcache.bin");
    
    // Configuration
    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");
+   
    // Read the main config file
-   string FName = Cnf.FindDir("Dir::Etc::main");
+   string FName = Cnf.FindFile("Dir::Etc::main");
    struct stat Buf;   
    if (stat(FName.c_str(),&Buf) != 0)
       return true;
-   return ReadConfigFile(Cnf,FName);
+   
+   // Read an alternate config file
+   const char *Cfg = getenv("APT_CONFIG");
+   
+   // Read both config files, either existing will be OK
+   if ((ReadConfigFile(Cnf,FName) != true) |
+       (ReadConfigFile(Cnf,Cfg) != true))
+      return false;
+   
+   if (Cnf.FindB("Debug::pkgInitialize",false) == true)
+      Cnf.Dump();
+      
+   return true;
 }
                                                                        /*}}}*/