[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#44135: [patch] fix



Attached is a possible fix for the problem that apt will not fallback
to another method if no cdrom is available. 

The patch is not perfect for i18n (because of the part in
acqprogress.cc). It dosn't matter for front-ends like synaptic as they
implement their own pkgAcquireProgress anyway but it does of course
for apt-get. We may just use the YnPrompt code from apt-get.cc here.

thanks,
 Michael

-- 
The first rule of holes is: when you find yourself in one, stop digging. - PJ
Linux is not The Answer. Yes is the answer. Linux is The Question. - Neo
--- orig/apt-pkg/acquire-method.cc
+++ mod/apt-pkg/acquire-method.cc
@@ -271,7 +271,7 @@
 	    MyMessages.erase(MyMessages.begin());
 	 }
 
-	 return !StringToBool(LookupTag(Message,"Fail"),false);
+	 return !StringToBool(LookupTag(Message,"Failed"),false);
       }
       
       Messages.push_back(Message);


--- orig/cmdline/acqprogress.cc
+++ mod/cmdline/acqprogress.cc
@@ -269,15 +269,26 @@
    if (Quiet <= 0)
       cout << '\r' << BlankLine << '\r';
    ioprintf(cout,_("Media Change: Please insert the disc labeled\n"
-		   " '%s'\n"
-		   "in the drive '%s' and press enter\n"),
-	    Media.c_str(),Drive.c_str());
+                   " '%s'\n"
+                   "in the drive '%s' and press enter to continue or 'c' to cancel.\n"),
+            Media.c_str(),Drive.c_str());
 
    char C = 0;
+   bool bStatus = true;
+
    while (C != '\n' && C != '\r')
+   {
+      if(C == 'c')
+         bStatus = false;
+
       read(STDIN_FILENO,&C,1);
-   
-   Update = true;
-   return true;
+   }
+   if(bStatus == false)
+      return false;
+   else
+   {
+      Update = true;
+      return true;
+   }
 }
 									/*}}}*/


--- orig/methods/cdrom.cc
+++ mod/methods/cdrom.cc
@@ -165,8 +165,7 @@
       if (MediaFail(Get.Host,CDROM) == false)
       {
 	 CurrentID = "FAIL";
-	 Fail(_("Wrong CD"),true);
-	 return true;
+	 return _error->Error(_("Disk not found."));
       }
    }
    



Reply to: