]> git.saurik.com Git - apt.git/blame - apt-private/private-main.cc
Add new Debug::RunScripts option
[apt.git] / apt-private / private-main.cc
CommitLineData
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>
b9179170
MV
11
12#include <apti18n.h>
13
14void CheckSimulateMode(CommandLine &CmdL)
15{
16 // simulate user-friendly if apt-get has no root privileges
17 if (getuid() != 0 && _config->FindB("APT::Get::Simulate") == true &&
18 (CmdL.FileSize() == 0 ||
19 (strcmp(CmdL.FileList[0], "source") != 0 && strcmp(CmdL.FileList[0], "download") != 0 &&
20 strcmp(CmdL.FileList[0], "changelog") != 0)))
21 {
22 if (_config->FindB("APT::Get::Show-User-Simulation-Note",true) == true)
23 std::cout << _("NOTE: This is only a simulation!\n"
24 " apt-get needs root privileges for real execution.\n"
25 " Keep also in mind that locking is deactivated,\n"
26 " so don't depend on the relevance to the real current situation!"
27 ) << std::endl;
28 _config->Set("Debug::NoLocking",true);
29 }
30}