init.cc 1.9 KB

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