]> git.saurik.com Git - apt.git/blame - apt-pkg/init.cc
Start on acquire stuff
[apt.git] / apt-pkg / init.cc
CommitLineData
9c14e3d6
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3b5421b4 3// $Id: init.cc,v 1.8 1998/10/20 02:39:19 jgg Exp $
9c14e3d6
AL
4/* ######################################################################
5
6 Init - Initialize the package library
7
8 ##################################################################### */
9 /*}}}*/
10// Include files /*{{{*/
094a497d 11#include <apt-pkg/init.h>
08e8f724
AL
12
13#include <sys/stat.h>
14#include <unistd.h>
9c14e3d6
AL
15 /*}}}*/
16
8efa2a3b 17// pkgInitialize - Initialize the configuration class /*{{{*/
9c14e3d6
AL
18// ---------------------------------------------------------------------
19/* Directories are specified in such a way that the FindDir function will
20 understand them. That is, if they don't start with a / then their parent
21 is prepended, this allows a fair degree of flexability. */
8efa2a3b 22bool pkgInitialize(Configuration &Cnf)
9c14e3d6
AL
23{
24 // General APT things
25 Cnf.Set("APT::Architecture","i386");
26
27 // State
28 Cnf.Set("Dir::State","/var/state/apt/");
29 Cnf.Set("Dir::State::lists","lists/");
b35d2f5f
AL
30
31 /* These really should be jammed into a generic 'Local Database' engine
32 which is yet to be determined. The functions in pkgcachegen should
33 be the only users of these */
9c14e3d6 34 Cnf.Set("Dir::State::xstatus","xstatus");
b35d2f5f
AL
35 Cnf.Set("Dir::State::userstatus","status.user");
36 Cnf.Set("Dir::State::status","/var/lib/dpkg/status");
9c14e3d6
AL
37
38 // Cache
7b0229fe 39 Cnf.Set("Dir::Cache","/var/cache/apt/");
9c14e3d6 40 Cnf.Set("Dir::Cache::archives","archives/");
e1b74f61
AL
41 Cnf.Set("Dir::Cache::srcpkgcache","srcpkgcache.bin");
42 Cnf.Set("Dir::Cache::pkgcache","pkgcache.bin");
9c14e3d6
AL
43
44 // Configuration
45 Cnf.Set("Dir::Etc","/etc/apt/");
46 Cnf.Set("Dir::Etc::sourcelist","sources.list");
47 Cnf.Set("Dir::Etc::main","apt.conf");
08e8f724
AL
48
49 // Read the main config file
3b5421b4 50 string FName = Cnf.FindFile("Dir::Etc::main");
08e8f724
AL
51 struct stat Buf;
52 if (stat(FName.c_str(),&Buf) != 0)
53 return true;
54 return ReadConfigFile(Cnf,FName);
9c14e3d6
AL
55}
56 /*}}}*/