]>
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>
19 void InitLocale(APT_CMD
const binary
) /*{{{*/
21 std::locale::global(std::locale(""));
25 case APT_CMD::APT_CACHE
:
26 case APT_CMD::APT_CDROM
:
27 case APT_CMD::APT_CONFIG
:
28 case APT_CMD::APT_HELPER
:
29 case APT_CMD::APT_GET
:
30 case APT_CMD::APT_MARK
:
33 case APT_CMD::APT_EXTRACTTEMPLATES
:
34 case APT_CMD::APT_FTPARCHIVE
:
35 case APT_CMD::APT_INTERNAL_SOLVER
:
36 case APT_CMD::APT_SORTPKG
:
37 textdomain("apt-utils");
43 void InitSignals() /*{{{*/
45 signal(SIGPIPE
,SIG_IGN
);
48 void CheckIfSimulateMode(CommandLine
&CmdL
) /*{{{*/
50 // disable locking in simulation, but show the message only for users
51 // as root hasn't the same problems like unreadable files which can heavily
52 // distort the simulation.
53 if (_config
->FindB("APT::Get::Simulate") == true &&
54 (CmdL
.FileSize() == 0 ||
55 (strcmp(CmdL
.FileList
[0], "source") != 0 && strcmp(CmdL
.FileList
[0], "download") != 0 &&
56 strcmp(CmdL
.FileList
[0], "changelog") != 0)))
58 if (getuid() != 0 && _config
->FindB("APT::Get::Show-User-Simulation-Note",true) == true)
59 std::cout
<< _("NOTE: This is only a simulation!\n"
60 " apt-get needs root privileges for real execution.\n"
61 " Keep also in mind that locking is deactivated,\n"
62 " so don't depend on the relevance to the real current situation!"
64 _config
->Set("Debug::NoLocking",true);
68 void CheckIfCalledByScript(int argc
, const char *argv
[]) /*{{{*/
70 if (unlikely(argc
< 1)) return;
72 if(!isatty(STDOUT_FILENO
) &&
73 _config
->FindB("Apt::Cmd::Disable-Script-Warning", false) == false)
75 std::cerr
<< std::endl
76 << "WARNING: " << flNotDir(argv
[0]) << " "
77 << "does not have a stable CLI interface. "
78 << "Use with caution in scripts."