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