summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-02-13 14:29:20 +0100
committerMichael Vogt <mvo@debian.org>2014-02-13 14:29:20 +0100
commit784e35e86293094bb5c1456c8f9c844df2a71f12 (patch)
tree28073f068ca09c46c04a5ed9e047824f782b15ac /cmdline
parenta84a4d2ab78c498d9797c07d463daec4095b37de (diff)
parent28b4b983d95fa742a5431547285a748e8b856399 (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: configure.ac debian/changelog
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-cdrom.cc76
-rw-r--r--cmdline/apt-get.cc10
-rw-r--r--cmdline/apt.cc2
3 files changed, 62 insertions, 26 deletions
diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc
index 17a60ddcb..20c6e8892 100644
--- a/cmdline/apt-cdrom.cc
+++ b/cmdline/apt-cdrom.cc
@@ -111,10 +111,12 @@ OpProgress* pkgCdromTextStatus::GetOpProgress()
};
/*}}}*/
// SetupAutoDetect /*{{{*/
-bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i)
+bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i, bool &automounted)
{
bool Debug = _config->FindB("Debug::Acquire::cdrom", false);
+ automounted = false;
+
vector<struct CdromDevice> v = UdevCdroms.Scan();
if (i >= v.size())
return false;
@@ -137,6 +139,8 @@ bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i)
mkdir(AptMountPoint.c_str(), 0750);
if(MountCdrom(AptMountPoint, v[i].DeviceName) == false)
_error->Warning(_("Failed to mount '%s' to '%s'"), v[i].DeviceName.c_str(), AptMountPoint.c_str());
+ else
+ automounted = true;
_config->Set("Acquire::cdrom::mount", AptMountPoint);
_config->Set("APT::CDROM::NoMount", true);
}
@@ -160,17 +164,35 @@ bool DoAdd(CommandLine &)
bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true);
unsigned int count = 0;
+ string AptMountPoint = _config->FindDir("Dir::Media::MountPath");
+ bool automounted = false;
if (AutoDetect && UdevCdroms.Dlopen())
- while (AutoDetectCdrom(UdevCdroms, count))
- res &= cdrom.Add(&log);
- if (count == 0) {
- res = cdrom.Add(&log);
- if (res == false) {
- _error->Error("%s", _(W_NO_CDROM_FOUND));
+ while (AutoDetectCdrom(UdevCdroms, count, automounted)) {
+ if (count == 1) {
+ // begin loop with res false to detect any success using OR
+ res = false;
+ }
+
+ // dump any warnings/errors from autodetect
+ if (_error->empty() == false)
+ _error->DumpErrors();
+
+ res |= cdrom.Add(&log);
+
+ if (automounted)
+ UnmountCdrom(AptMountPoint);
+
+ // dump any warnings/errors from add/unmount
+ if (_error->empty() == false)
+ _error->DumpErrors();
}
- }
- if(res)
+ if (count == 0)
+ res = cdrom.Add(&log);
+
+ if (res == false)
+ _error->Error("%s", _(W_NO_CDROM_FOUND));
+ else
cout << _("Repeat this process for the rest of the CDs in your set.") << endl;
return res;
@@ -187,18 +209,38 @@ bool DoIdent(CommandLine &)
pkgCdrom cdrom;
bool res = true;
- bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect");
+ bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true);
unsigned int count = 0;
+ string AptMountPoint = _config->FindDir("Dir::Media::MountPath");
+ bool automounted = false;
if (AutoDetect && UdevCdroms.Dlopen())
- while (AutoDetectCdrom(UdevCdroms, count))
- res &= cdrom.Ident(ident, &log);
- if (count == 0) {
- res = cdrom.Ident(ident, &log);
- if (res == false) {
- _error->Error("%s", _(W_NO_CDROM_FOUND));
+ while (AutoDetectCdrom(UdevCdroms, count, automounted)) {
+ if (count == 1) {
+ // begin loop with res false to detect any success using OR
+ res = false;
+ }
+
+ // dump any warnings/errors from autodetect
+ if (_error->empty() == false)
+ _error->DumpErrors();
+
+ res |= cdrom.Ident(ident, &log);
+
+ if (automounted)
+ UnmountCdrom(AptMountPoint);
+
+ // dump any warnings/errors from add/unmount
+ if (_error->empty() == false)
+ _error->DumpErrors();
}
- }
+
+ if (count == 0)
+ res = cdrom.Ident(ident, &log);
+
+ if (res == false)
+ _error->Error("%s", _(W_NO_CDROM_FOUND));
+
return res;
}
/*}}}*/
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 9fae8d55c..c956f557a 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -630,8 +630,8 @@ bool DoDownload(CommandLine &CmdL)
return false;
APT::CacheSetHelper helper(c0out);
- APT::VersionList verset = APT::VersionList::FromCommandLine(Cache,
- CmdL.FileList + 1, APT::VersionList::CANDIDATE, helper);
+ APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache,
+ CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper);
if (verset.empty() == true)
return false;
@@ -650,7 +650,7 @@ bool DoDownload(CommandLine &CmdL)
std::string const cwd = SafeGetCWD();
_config->Set("Dir::Cache::Archives", cwd);
int i = 0;
- for (APT::VersionList::const_iterator Ver = verset.begin();
+ for (APT::VersionSet::const_iterator Ver = verset.begin();
Ver != verset.end(); ++Ver, ++i)
{
pkgAcquire::Item *I = new pkgAcqArchive(&Fetcher, SrcList, &Recs, *Ver, storefile[i]);
@@ -1739,10 +1739,6 @@ int main(int argc,const char *argv[]) /*{{{*/
// see if we are in simulate mode
CheckSimulateMode(CmdL);
- // Deal with stdout not being a tty
- if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1)
- _config->Set("quiet","1");
-
// Setup the output streams
InitOutput();
diff --git a/cmdline/apt.cc b/cmdline/apt.cc
index 6fe25e3f3..6ad470faa 100644
--- a/cmdline/apt.cc
+++ b/cmdline/apt.cc
@@ -156,8 +156,6 @@ int main(int argc, const char *argv[]) /*{{{*/
<< std::endl
<< std::endl;
}
- if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1)
- _config->Set("quiet","1");
// See if the help should be shown
if (_config->FindB("help") == true ||