677
// DoIdent - Ident a CDROM /*{{{*/
678
// ---------------------------------------------------------------------
680
bool DoIdent(CommandLine &)
683
string CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
685
CDROM= SafeGetCWD() + '/' + CDROM;
687
cout << "Using CD-ROM mount point " << CDROM << endl;
688
cout << "Mounting CD-ROM" << endl;
689
if (MountCdrom(CDROM) == false)
690
return _error->Error("Failed to mount the cdrom.");
692
// Hash the CD to get an ID
693
cout << "Identifying.. " << flush;
695
if (IdentCdrom(CDROM,ID) == false)
701
cout << '[' << ID << ']' << endl;
704
Configuration Database;
705
string DFile = _config->FindFile("Dir::State::cdroms");
706
if (FileExists(DFile) == true)
708
if (ReadConfigFile(Database,DFile) == false)
709
return _error->Error("Unable to read the cdrom database %s",
712
cout << "Stored Label: '" << Database.Find("CD::" + ID) << "'" << endl;
667
717
// ShowHelp - Show the help screen /*{{{*/
668
718
// ---------------------------------------------------------------------
672
cout << PACKAGE << ' ' << VERSION << " for " << ARCHITECTURE <<
673
" compiled on " << __DATE__ << " " << __TIME__ << endl;
722
ioprintf(cout,_("%s %s for %s %s compiled on %s %s\n"),PACKAGE,VERSION,
723
COMMON_OS,COMMON_CPU,__DATE__,__TIME__);
674
724
if (_config->FindB("version") == true)
677
cout << "Usage: apt-cdrom [options] command" << endl;
679
cout << "apt-cdrom is a tool to add CDROM's to APT's source list. The " << endl;
680
cout << "CDROM mount point and device information is taken from apt.conf" << endl;
681
cout << "and /etc/fstab." << endl;
683
cout << "Commands:" << endl;
684
cout << " add - Add a CDROM" << endl;
686
cout << "Options:" << endl;
687
cout << " -h This help text" << endl;
688
cout << " -d CD-ROM mount point" << endl;
689
cout << " -r Rename a recognized CD-ROM" << endl;
690
cout << " -m No mounting" << endl;
691
cout << " -f Fast mode, don't check package files" << endl;
692
cout << " -a Thorough scan mode" << endl;
693
cout << " -c=? Read this configuration file" << endl;
694
cout << " -o=? Set an arbitary configuration option, eg -o dir::cache=/tmp" << endl;
695
cout << "See fstab(5)" << endl;
728
"Usage: apt-cdrom [options] command\n"
730
"apt-cdrom is a tool to add CDROM's to APT's source list. The\n"
731
"CDROM mount point and device information is taken from apt.conf\n"
735
" add - Add a CDROM\n"
736
" ident - Report the identity of a CDROM\n"
739
" -h This help text\n"
740
" -d CD-ROM mount point\n"
741
" -r Rename a recognized CD-ROM\n"
743
" -f Fast mode, don't check package files\n"
744
" -a Thorough scan mode\n"
745
" -c=? Read this configuration file\n"
746
" -o=? Set an arbitary configuration option, eg -o dir::cache=/tmp\n"
716
768
CommandLine::Dispatch Cmds[] = {
720
773
// Parse the command line and initialize the package library
721
774
CommandLine CmdL(Args,_config);
722
if (pkgInitialize(*_config) == false ||
723
CmdL.Parse(argc,argv) == false)
775
if (pkgInitConfig(*_config) == false ||
776
CmdL.Parse(argc,argv) == false ||
777
pkgInitSystem(*_config,_system) == false)
725
779
_error->DumpErrors();