Skip to content

Instantly share code, notes, and snippets.

@Menziess
Last active October 14, 2019 22:09
Show Gist options
  • Save Menziess/cbff9948d9f3abe07ddbcb34225e1dcb to your computer and use it in GitHub Desktop.
Save Menziess/cbff9948d9f3abe07ddbcb34225e1dcb to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Usage: curl https://pyenv.run | bash
#
# For more info, visit: https://raw.githubusercontent.com/pyenv/pyenv-installer
#
set -e
echo "> Prechecks"
if [[ -z "$http_proxy" ]]; then
echo "Please export http_proxy variable in your ~/.bashrc" 1>&2
exit 1
fi
if ! which git &>/dev/null; then
echo "Please install git"
exit 1
fi
echo "> Setting apt, curl, and wget config settings"
echo "Acquire::http::Proxy $http_proxy;" >> /etc/apt/apt.conf
echo "check_certificate = off" >> ~/.wgetrc
echo insecure >> ~/.curlrc
echo "> Setting some ~/.bashrc commands"
cat >>~/.bashrc <<EOL
# Proxy settings
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
export FTP_PROXY=$http_proxy
export DNS_PROXY=$http_proxy
export RSYNC_PROXY=$http_proxy
export ALL_PROXY=$http_proxy
export NO_PROXY="localhost"
# Pipenv
export PIPENV_VENV_IN_PROJECT=1
# Pyenv
export PATH="/home/$USER/.pyenv/bin:$PATH"
# For git only
git config --global http.proxyAuthMethod 'basic'
EOL
echo "> Installing pyenv"
curl -s -S -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment