summaryrefslogtreecommitdiff
path: root/cmdline/apt-get.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-06-29 16:55:49 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2009-06-29 16:55:49 +0200
commit55a5a46c235a30bf024fb2301066553953701cc5 (patch)
tree1e65a90a93f8ce8c07317c12cd724bad0206474e /cmdline/apt-get.cc
parentafe4d2a556535dbc9475ac1665c380a235dd28de (diff)
support running "--simulate" as user
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r--cmdline/apt-get.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 028f371b5..faad2ed6b 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -2788,7 +2788,18 @@ int main(int argc,const char *argv[])
ShowHelp(CmdL);
return 0;
}
-
+
+ // simulate user-friendly if apt-get has no root privileges
+ if (getuid() != 0 && _config->FindB("APT::Get::Simulate") == true)
+ {
+ cout << _("NOTE: This is only a simulation!\n"
+ " apt-get needs root privileges for real execution.\n"
+ " Keep also in mind that locking is deactivated,\n"
+ " so don't depend on the relevance to the real current situation!"
+ ) << std::endl;
+ _config->Set("Debug::NoLocking",true);
+ }
+
// Deal with stdout not being a tty
if (!isatty(STDOUT_FILENO) && _config->FindI("quiet",0) < 1)
_config->Set("quiet","1");