]> git.saurik.com Git - apt.git/blob - apt-pkg/init.cc
Closed bugs
[apt.git] / apt-pkg / init.cc
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: init.cc,v 1.6 1998/09/26 05:34:19 jgg Exp $
4 /* ######################################################################
5
6 Init - Initialize the package library
7
8 ##################################################################### */
9 /*}}}*/
10 // Include files /*{{{*/
11 #include <apt-pkg/init.h>
12
13 #include <sys/stat.h>
14 #include <unistd.h>
15 /*}}}*/
16
17 // pkgInitialize - Initialize the configuration class /*{{{*/
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. */
22 bool pkgInitialize(Configuration &Cnf)
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/");
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 */
34 Cnf.Set("Dir::State::xstatus","xstatus");
35 Cnf.Set("Dir::State::userstatus","status.user");
36 Cnf.Set("Dir::State::status","/var/lib/dpkg/status");
37
38 // Cache
39 Cnf.Set("Dir::Cache","/tmp/");
40 Cnf.Set("Dir::Cache::archives","archives/");
41 Cnf.Set("Dir::Cache::srcpkgcache","srcpkgcache.bin");
42 Cnf.Set("Dir::Cache::pkgcache","pkgcache.bin");
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");
48
49 // Read the main config file
50 string FName = Cnf.FindDir("Dir::Etc::main");
51 struct stat Buf;
52 if (stat(FName.c_str(),&Buf) != 0)
53 return true;
54 return ReadConfigFile(Cnf,FName);
55 }
56 /*}}}*/