summaryrefslogtreecommitdiff
path: root/apt-private/private-install.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-10-16 12:54:14 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-11-04 18:04:01 +0100
commit73fe49f9b4748eddb5a2dad4f0abb51a8f63564c (patch)
treec1199076283004e3f77a88ec804a7dfd1611abfd /apt-private/private-install.cc
parent002b1bc46b18e9d309d337ddb15a6ccdfb6c9dde (diff)
suggest 'apt autoremove' to get right of unneeded packages
The bugreport is more conservative in asking for a conditional, but given that this is a message intended to be read by users to be run by users we should suggest using a command intended to be used by users. And while we are at, add sudo to the message – conditional of course. Closes: 801571
Diffstat (limited to 'apt-private/private-install.cc')
-rw-r--r--apt-private/private-install.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index a9d93a92a..dda5b50be 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -484,7 +484,11 @@ static bool DoAutomaticRemove(CacheFile &Cache)
else
ioprintf(c1out, P_("%lu package was automatically installed and is no longer required.\n",
"%lu packages were automatically installed and are no longer required.\n", autoRemoveCount), autoRemoveCount);
- c1out << P_("Use 'apt-get autoremove' to remove it.", "Use 'apt-get autoremove' to remove them.", autoRemoveCount) << std::endl;
+ std::string autocmd = "apt autoremove";
+ if (getenv("SUDO_USER") != NULL)
+ autocmd = "sudo " + autocmd;
+ ioprintf(c1out, P_("Use '%s' to remove it.", "Use '%s' to remove them.", autoRemoveCount), autocmd.c_str());
+ c1out << std::endl;
}
return true;
}