mikhail / rpms / hplip

Forked from rpms/hplip 6 months ago
Clone
Blob Blame History Raw
diff --git a/installer/pluginhandler.py b/installer/pluginhandler.py
index 56683fb..031ceec 100755
--- a/installer/pluginhandler.py
+++ b/installer/pluginhandler.py
@@ -185,14 +185,16 @@ class PluginHandle(object):
                 if self.__plugin_conf_file.startswith('file://'):
                     status, filename = utils.download_from_network(self.__plugin_conf_file, local_conf, True)
                 else:
-                    wget = utils.which("wget", True)
-                    if wget:
-                        status, output = utils.run("%s --tries=3 --timeout=60 --output-document=%s %s --cache=off" %(wget, local_conf, self.__plugin_conf_file))
+                    curl = utils.which("curl", True)
+                    if curl:
+                        cmd = "%s --retry 3 --max-time 10 --output %s --location %s" %(curl, local_conf, self.__plugin_conf_file)
+                        log.debug(cmd)
+                        status, output = utils.run(cmd)
                         if status:
                             log.error("Plugin download failed with error code = %d" %status)
                             return status, url, check_sum
                     else:
-                        log.error("Please install wget package to download the plugin.")
+                        log.error("Please install curl package to download the plugin.")
                         return status, url, check_sum
             except IOError as e:
                 log.error("I/O Error: %s" % e.strerror)
@@ -284,18 +284,18 @@ class PluginHandle(object):
             if src.startswith('file://'):
                 status, filename = utils.download_from_network(src, plugin_file, True)
             else:
-                wget = utils.which("wget", True)
-                if wget:
-                    cmd = "%s --cache=off -P %s %s" % (wget,self.__plugin_path,src)
+                curl = utils.which("curl", True)
+                if curl:
+                    cmd = "%s --create-dirs -O --output-dir %s %s" % (curl,self.__plugin_path,src)
                     log.debug(cmd)
                     status, output = utils.run(cmd)
-                    log.debug("wget returned: %d" % status)
+                    log.debug("curl returned: %d" % status)
 
                 #Check whether plugin is accessible in Openprinting.org website otherwise dowload plugin from alternate location.
                 if status != 0 or os_utils.getFileSize(plugin_file) <= 0:
                     src = os.path.join(PLUGIN_FALLBACK_LOCATION, self.__plugin_name)
                     log.info("Plugin is not accessible. Trying to download it from fallback location: [%s]" % src)
-                    cmd = "%s --cache=off -P %s %s" % (wget,self.__plugin_path,src)
+                    cmd = "%s --create-dirs -O --output-dir %s %s" % (curl,self.__plugin_path,src)
                     log.debug(cmd)
                     status, output = utils.run(cmd)
 
@@ -323,7 +323,7 @@ class PluginHandle(object):
             if digsig_url.startswith('file://'):
                 status, filename = utils.download_from_network(digsig_url, digsig_file, True)
             else:
-                cmd = "%s --cache=off -P %s %s" % (wget,self.__plugin_path,digsig_url)
+                cmd = "%s --create-dirs -O --output-dir %s %s" % (curl, self.__plugin_path,digsig_url)
                 log.debug(cmd)
                 status, output = utils.run(cmd)
         except IOError as e: