ubuntu 安装 flashplugin-installer 失败解决办法

8000阅读 0评论2015-01-26 jasenwan88
分类:LINUX

ubuntu 是通过 /usr/lib/update-notifier/package-data-downloader 完成这件事的,它是个 python 脚本,里面用到了urllib,但是这个库不支持 proxy,所以会导致 deb 安装失败。
等 ubuntu 解决这类问题之前,需要自己先找个 workaround 的办法:
打开 /usr/lib/update-notifier/package-data-downloader  找到下面这段:
Python代码:  
  1. for i in range(len(files)):  
  2.         print "%s: downloading %s" % (relfile, files[i])  
  3.         dest_file = urllib.urlretrieve(files[i])[0]  
  4.         output = subprocess.check_output(["sha256sum", dest_file])  
  5.         output = output.split(' ')[0]  
  6.         if output == sums[i]:  
  7.                 command.append(dest_file)  
  8.         else:  
  9.                 record_failure(relfile)  
  10.                 break  
将 urllib.urlretrieve 改成 wget,改之后如下:
Python代码:  
  1. for i in range(len(files)):  
  2.         print "%s: downloading %s" % (relfile, files[i])  
  3.         #dest_file = urllib.urlretrieve(files[i])[0]  
  4.         dest_file = files[i].split("/")[-1]  
  5.         dest_file = '/tmp/' + dest_file  
  6.         downf = "/usr/bin/wget %s -O %s" % (files[i], dest_file)  
  7.         subprocess.call(downf, shell=True)  
  8.         output = subprocess.check_output(["sha256sum", dest_file])  
  9.         output = output.split(' ')[0]  
  10.         if output == sums[i]:  
  11.                 command.append(dest_file)  
  12.         else:  
  13.                 record_failure(relfile)  
  14.                 break  
 剩下的事情就是在 /etc/wgetrc 里面配置代理(略)
上一篇:Linux系统UTC和CST时间转换
下一篇:ubuntu 15.10 安装vsftpd