]>
Commit | Line | Data |
---|---|---|
9c14e3d6 AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
c7c1b0f6 | 3 | // $Id: init.cc,v 1.12 1998/11/06 02:52:21 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> |
5a43a241 | 12 | #include <apt-pkg/fileutl.h> |
93bf083d | 13 | #include <config.h> |
9c14e3d6 AL |
14 | /*}}}*/ |
15 | ||
8efa2a3b | 16 | // pkgInitialize - Initialize the configuration class /*{{{*/ |
9c14e3d6 AL |
17 | // --------------------------------------------------------------------- |
18 | /* Directories are specified in such a way that the FindDir function will | |
19 | understand them. That is, if they don't start with a / then their parent | |
20 | is prepended, this allows a fair degree of flexability. */ | |
8efa2a3b | 21 | bool pkgInitialize(Configuration &Cnf) |
9c14e3d6 AL |
22 | { |
23 | // General APT things | |
93bf083d | 24 | Cnf.Set("APT::Architecture",ARCHITECTURE); |
9c14e3d6 AL |
25 | |
26 | // State | |
27 | Cnf.Set("Dir::State","/var/state/apt/"); | |
28 | Cnf.Set("Dir::State::lists","lists/"); | |
b35d2f5f AL |
29 | |
30 | /* These really should be jammed into a generic 'Local Database' engine | |
31 | which is yet to be determined. The functions in pkgcachegen should | |
32 | be the only users of these */ | |
9c14e3d6 | 33 | Cnf.Set("Dir::State::xstatus","xstatus"); |
b35d2f5f AL |
34 | Cnf.Set("Dir::State::userstatus","status.user"); |
35 | Cnf.Set("Dir::State::status","/var/lib/dpkg/status"); | |
9c14e3d6 AL |
36 | |
37 | // Cache | |
7b0229fe | 38 | Cnf.Set("Dir::Cache","/var/cache/apt/"); |
9c14e3d6 | 39 | Cnf.Set("Dir::Cache::archives","archives/"); |
e1b74f61 AL |
40 | Cnf.Set("Dir::Cache::srcpkgcache","srcpkgcache.bin"); |
41 | Cnf.Set("Dir::Cache::pkgcache","pkgcache.bin"); | |
9c14e3d6 AL |
42 | |
43 | // Configuration | |
44 | Cnf.Set("Dir::Etc","/etc/apt/"); | |
45 | Cnf.Set("Dir::Etc::sourcelist","sources.list"); | |
46 | Cnf.Set("Dir::Etc::main","apt.conf"); | |
bfd22fc0 | 47 | Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods"); |
93bf083d | 48 | |
08e8f724 | 49 | // Read the main config file |
3b5421b4 | 50 | string FName = Cnf.FindFile("Dir::Etc::main"); |
5a43a241 AL |
51 | bool Res = true; |
52 | if (FileExists(FName) == true) | |
53 | Res &= ReadConfigFile(Cnf,FName); | |
93bf083d AL |
54 | |
55 | // Read an alternate config file | |
56 | const char *Cfg = getenv("APT_CONFIG"); | |
c7c1b0f6 | 57 | if (Cfg != 0 && FileExists(Cfg) == true) |
5a43a241 | 58 | Res &= ReadConfigFile(Cnf,Cfg); |
93bf083d | 59 | |
5a43a241 | 60 | if (Res == false) |
93bf083d AL |
61 | return false; |
62 | ||
63 | if (Cnf.FindB("Debug::pkgInitialize",false) == true) | |
64 | Cnf.Dump(); | |
65 | ||
66 | return true; | |
9c14e3d6 AL |
67 | } |
68 | /*}}}*/ |