| 1 | |
| 2 | #include<unistd.h> |
| 3 | #include<cstring> |
| 4 | |
| 5 | #include <apt-pkg/configuration.h> |
| 6 | #include "private-main.h" |
| 7 | |
| 8 | #include <apti18n.h> |
| 9 | |
| 10 | void CheckSimulateMode(CommandLine &CmdL) |
| 11 | { |
| 12 | // simulate user-friendly if apt-get has no root privileges |
| 13 | if (getuid() != 0 && _config->FindB("APT::Get::Simulate") == true && |
| 14 | (CmdL.FileSize() == 0 || |
| 15 | (strcmp(CmdL.FileList[0], "source") != 0 && strcmp(CmdL.FileList[0], "download") != 0 && |
| 16 | strcmp(CmdL.FileList[0], "changelog") != 0))) |
| 17 | { |
| 18 | if (_config->FindB("APT::Get::Show-User-Simulation-Note",true) == true) |
| 19 | std::cout << _("NOTE: This is only a simulation!\n" |
| 20 | " apt-get needs root privileges for real execution.\n" |
| 21 | " Keep also in mind that locking is deactivated,\n" |
| 22 | " so don't depend on the relevance to the real current situation!" |
| 23 | ) << std::endl; |
| 24 | _config->Set("Debug::NoLocking",true); |
| 25 | } |
| 26 | } |