]>
Commit | Line | Data |
---|---|---|
453b82a3 | 1 | #include <config.h> |
b9179170 | 2 | |
453b82a3 | 3 | #include <apt-pkg/cmndline.h> |
b9179170 | 4 | #include <apt-pkg/configuration.h> |
453b82a3 DK |
5 | |
6 | #include <apt-private/private-main.h> | |
7 | ||
8 | #include <iostream> | |
9 | #include <string.h> | |
10 | #include <unistd.h> | |
3163087b | 11 | #include <signal.h> |
b9179170 MV |
12 | |
13 | #include <apti18n.h> | |
14 | ||
3163087b MV |
15 | |
16 | void InitSignals() | |
17 | { | |
18 | // Setup the signals | |
19 | signal(SIGPIPE,SIG_IGN); | |
20 | } | |
21 | ||
22 | ||
b9179170 MV |
23 | void CheckSimulateMode(CommandLine &CmdL) |
24 | { | |
0d5b9da9 DK |
25 | // disable locking in simulation, but show the message only for users |
26 | // as root hasn't the same problems like unreadable files which can heavily | |
27 | // distort the simulation. | |
28 | if (_config->FindB("APT::Get::Simulate") == true && | |
b9179170 MV |
29 | (CmdL.FileSize() == 0 || |
30 | (strcmp(CmdL.FileList[0], "source") != 0 && strcmp(CmdL.FileList[0], "download") != 0 && | |
31 | strcmp(CmdL.FileList[0], "changelog") != 0))) | |
32 | { | |
0d5b9da9 | 33 | if (getuid() != 0 && _config->FindB("APT::Get::Show-User-Simulation-Note",true) == true) |
b9179170 MV |
34 | std::cout << _("NOTE: This is only a simulation!\n" |
35 | " apt-get needs root privileges for real execution.\n" | |
36 | " Keep also in mind that locking is deactivated,\n" | |
37 | " so don't depend on the relevance to the real current situation!" | |
38 | ) << std::endl; | |
39 | _config->Set("Debug::NoLocking",true); | |
40 | } | |
41 | } |