]>
git.saurik.com Git - apt.git/blob - apt-private/private-main.cc
0a9f4713fcd8c9b1fafd845440a13eef0e46259c
3 #include <apt-pkg/cmndline.h>
4 #include <apt-pkg/configuration.h>
5 #include <apt-pkg/fileutl.h>
7 #include <apt-private/private-main.h>
19 void InitLocale() /*{{{*/
21 std::locale::global(std::locale(""));
25 void InitSignals() /*{{{*/
27 signal(SIGPIPE
,SIG_IGN
);
30 void CheckIfSimulateMode(CommandLine
&CmdL
) /*{{{*/
32 // disable locking in simulation, but show the message only for users
33 // as root hasn't the same problems like unreadable files which can heavily
34 // distort the simulation.
35 if (_config
->FindB("APT::Get::Simulate") == true &&
36 (CmdL
.FileSize() == 0 ||
37 (strcmp(CmdL
.FileList
[0], "source") != 0 && strcmp(CmdL
.FileList
[0], "download") != 0 &&
38 strcmp(CmdL
.FileList
[0], "changelog") != 0)))
40 if (getuid() != 0 && _config
->FindB("APT::Get::Show-User-Simulation-Note",true) == true)
41 std::cout
<< _("NOTE: This is only a simulation!\n"
42 " apt-get needs root privileges for real execution.\n"
43 " Keep also in mind that locking is deactivated,\n"
44 " so don't depend on the relevance to the real current situation!"
46 _config
->Set("Debug::NoLocking",true);
50 void CheckIfCalledByScript(int argc
, const char *argv
[]) /*{{{*/
52 if (unlikely(argc
< 1)) return;
54 if(!isatty(STDOUT_FILENO
) &&
55 _config
->FindB("Apt::Cmd::Disable-Script-Warning", false) == false)
57 std::cerr
<< std::endl
58 << "WARNING: " << flNotDir(argv
[0]) << " "
59 << "does not have a stable CLI interface. "
60 << "Use with caution in scripts."