Skip to content

Instantly share code, notes, and snippets.

@kuoe0
Last active December 20, 2015 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuoe0/6192061 to your computer and use it in GitHub Desktop.
Save kuoe0/6192061 to your computer and use it in GitHub Desktop.
#!/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 <kuoe0.tw@gmail.com>
# 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