]> git.saurik.com Git - apt.git/commitdiff
Improve the apt-cdrom output when no CD-ROM can be auto-detected
authorMichael Vogt <mvo@debian.org>
Sat, 22 Jun 2013 08:03:24 +0000 (10:03 +0200)
committerMichael Vogt <mvo@debian.org>
Sat, 22 Jun 2013 08:03:24 +0000 (10:03 +0200)
(closes: #712433)

cmdline/apt-cdrom.cc
doc/apt-cdrom.8.xml

index 70e49910c48dae6494f660bf0987bdd5c75ffbd7..520b1e0a0badff2e43b03494550864cbbdcd4c60 100644 (file)
 
 #include <apti18n.h>
                                                                        /*}}}*/
+static const char *W_NO_CDROM_FOUND = \
+   N_("No CD-ROM could be auto-detected or found using "
+      "the default mount path.\n"
+      "You may try the --cdrom option to set the CD-ROM mount path. "
+      "See 'man apt-cdrom' for more "
+      "information about the CD-ROM auto-detection and mount path.");
 
 using namespace std;
 
@@ -135,7 +141,6 @@ bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i)
    return true;
 }
                                                                        /*}}}*/
-
 // DoAdd - Add a new CDROM                                             /*{{{*/
 // ---------------------------------------------------------------------
 /* This does the main add bit.. We show some status and things. The
@@ -154,8 +159,12 @@ bool DoAdd(CommandLine &)
    if (AutoDetect && UdevCdroms.Dlopen())
       while (AutoDetectCdrom(UdevCdroms, count))
         res &= cdrom.Add(&log);
-   if (count == 0)
+   if (count == 0) {
       res = cdrom.Add(&log);
+      if (res == false) {
+         _error->Warning(_(W_NO_CDROM_FOUND));
+      }
+   }
 
    if(res)
       cout << _("Repeat this process for the rest of the CDs in your set.") << endl;
@@ -180,8 +189,12 @@ bool DoIdent(CommandLine &)
    if (AutoDetect && UdevCdroms.Dlopen())
       while (AutoDetectCdrom(UdevCdroms, count))
         res &= cdrom.Ident(ident, &log);
-   if (count == 0)
-      return cdrom.Ident(ident, &log);
+   if (count == 0) {
+      res = cdrom.Ident(ident, &log);
+      if (res == false) {
+         _error->Warning(_(W_NO_CDROM_FOUND));
+      }
+   }
    return res;
 }
                                                                        /*}}}*/
@@ -213,7 +226,7 @@ int ShowHelp()
       "  -m   No mounting\n"
       "  -f   Fast mode, don't check package files\n"
       "  -a   Thorough scan mode\n"
-      "  --auto-detect Auto detect drive and mount point\n"
+      "  --no-auto-detect Do not try to auto detect drive and mount point\n"
       "  -c=? Read this configuration file\n"
       "  -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n"
       "See fstab(5)\n";
@@ -224,7 +237,7 @@ int main(int argc,const char *argv[])                                       /*{{{*/
 {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
-      {  0,"auto-detect","Acquire::cdrom::AutoDetect",0},
+      {  0,"auto-detect","Acquire::cdrom::AutoDetect", CommandLine::Boolean},
       {'v',"version","version",0},
       {'d',"cdrom","Acquire::cdrom::mount",CommandLine::HasArg},
       {'r',"rename","APT::CDROM::Rename",0},
index 943511f03cb9b856fe64941eeb7134c2cf3663f9..b076a98a3e08460139e08062f9c1b7ed8ef0b910 100644 (file)
    &apt-cmdblurb;
    
    <variablelist>
+     <varlistentry><term><option>--no-auto-detect</option></term><term><option>--cdrom</option></term>
+     <listitem><para>Do not try to auto-detect the CD-ROM path. Usually combined with the <option>--cdrom</option> option.
+      Configuration Item: <literal>Acquire::cdrom::AutoDetect</literal>.
+     </para>
+     </listitem>
+     </varlistentry>
+     
+
      <varlistentry><term><option>-d</option></term><term><option>--cdrom</option></term>
      <listitem><para>Mount point; specify the location to mount the CD-ROM. This
       mount point must be listed in <filename>/etc/fstab</filename> and