]> git.saurik.com Git - apt.git/blame_incremental - apt-private/private-main.cc
rewrite all TFRewrite instances to use the new pkgTagSection::Write
[apt.git] / apt-private / private-main.cc
... / ...
CommitLineData
1#include <config.h>
2
3#include <apt-pkg/cmndline.h>
4#include <apt-pkg/configuration.h>
5
6#include <apt-private/private-main.h>
7
8#include <iostream>
9#include <string.h>
10#include <unistd.h>
11#include <signal.h>
12
13#include <apti18n.h>
14
15
16void InitSignals()
17{
18 // Setup the signals
19 signal(SIGPIPE,SIG_IGN);
20}
21
22
23void CheckSimulateMode(CommandLine &CmdL)
24{
25 // simulate user-friendly if apt-get has no root privileges
26 if (getuid() != 0 && _config->FindB("APT::Get::Simulate") == true &&
27 (CmdL.FileSize() == 0 ||
28 (strcmp(CmdL.FileList[0], "source") != 0 && strcmp(CmdL.FileList[0], "download") != 0 &&
29 strcmp(CmdL.FileList[0], "changelog") != 0)))
30 {
31 if (_config->FindB("APT::Get::Show-User-Simulation-Note",true) == true)
32 std::cout << _("NOTE: This is only a simulation!\n"
33 " apt-get needs root privileges for real execution.\n"
34 " Keep also in mind that locking is deactivated,\n"
35 " so don't depend on the relevance to the real current situation!"
36 ) << std::endl;
37 _config->Set("Debug::NoLocking",true);
38 }
39}