Last active
December 20, 2015 20:39
-
-
Save kuoe0/6192061 to your computer and use it in GitHub Desktop.
解決 pycurl 造成的 gnutls_handshake() failed 錯誤 http://blog.kuoe0.ch/posts/84360/resolve-the-error-gnutls-handshake-failed-caused-by-pycurl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# ============================================================================= | |
# FileName: Install_OpenSSL_PyCurl.sh | |
# Desc: Build PyCurl with OpenSSL and Install it | |
# Environment: Ubuntu 13.04 amd64 | |
# Usage: ./Install_OpenSSL_PyCurl.sh | |
# Author: KuoE0 <[email protected]> | |
# HomePage: http://kuoe0.tw/ | |
# Copyright: BSD License (C) 2013 KuoE0 | |
# ============================================================================= | |
work_path=/tmp/python-pycurl-openssl | |
echo -e $work_path | |
echo -e "\x1b[33msudo apt-get -y install build-essential fakeroot dpkg-dev\x1b[0m" | |
sudo apt-get -y install build-essential fakeroot dpkg-dev | |
mkdir $work_path | |
cd $work_path | |
echo -e "\x1b[33msudo apt-get source python-pycurl\x1b[0m" | |
sudo apt-get source python-pycurl | |
echo -e "\x1b[33msudo apt-get -y build-dep python-pycurl\x1b[0m" | |
sudo apt-get -y build-dep python-pycurl | |
echo -e "\x1b[33msudo apt-get -y install libcurl4-openssl-dev\x1b[0m" | |
sudo apt-get -y install libcurl4-openssl-dev | |
find . -name "*.dsc" | xargs sudo dpkg-source -x | |
dir=`find $work_path -maxdepth 1 -mindepth 1 -type d` | |
cd $dir | |
echo -e "\x1b[33mreplace gnutls with openssl\x1b[0m" | |
sudo sed --in-place 's/libcurl4-gnutls-dev/libcurl4-openssl-dev/g' debian/control | |
echo -e "\x1b[33msudo dpkg-buildpackage -rfakeroot -b\x1b[0m" | |
sudo dpkg-buildpackage -rfakeroot -b | |
find $work_path -name "*.deb" -exec sudo dpkg -i {} \; | |
cd /tmp | |
# prevent to upgrade from APT | |
dpkg --get-selections | grep pycurl > $work_path/PYCURL | |
sed -e 's/install/hold/' $work_path/PYCURL | sudo dpkg --set-selections | |
sudo rm -r $work_path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment