+
+ // Unmount and finish
+ if (_config->FindB("APT::CDROM::NoMount",false) == false)
+ UnmountCdrom(CDROM);
+
+ return true;
+}
+ /*}}}*/
+// DoIdent - Ident a CDROM /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool DoIdent(CommandLine &)
+{
+ // Startup
+ string CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
+ if (CDROM[0] == '.')
+ CDROM= SafeGetCWD() + '/' + CDROM;
+
+ cout << "Using CD-ROM mount point " << CDROM << endl;
+ cout << "Mounting CD-ROM" << endl;
+ if (MountCdrom(CDROM) == false)
+ return _error->Error("Failed to mount the cdrom.");
+
+ // Hash the CD to get an ID
+ cout << "Identifying.. " << flush;
+ string ID;
+ if (IdentCdrom(CDROM,ID) == false)
+ {
+ cout << endl;
+ return false;
+ }
+
+ cout << '[' << ID << ']' << endl;
+
+ // Read the database
+ Configuration Database;
+ string DFile = _config->FindFile("Dir::State::cdroms");
+ if (FileExists(DFile) == true)
+ {
+ if (ReadConfigFile(Database,DFile) == false)
+ return _error->Error("Unable to read the cdrom database %s",
+ DFile.c_str());
+ }
+ cout << "Stored Label: '" << Database.Find("CD::" + ID) << "'" << endl;