curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
#!/bin/bash
unknown_os ()
{
echo "Unfortunately, your operating system distribution and version are not supported by this script."
echo
echo "You can override the OS detection by setting os= and dist= prior to running this script."
echo "You can find a list of supported OSes and distributions on our website: https://packagecloud.io/docs#os_distro_version"
echo
echo "For example, to force Ubuntu Trusty: os=ubuntu dist=trusty ./script.sh"
echo
echo "Please email [email protected] and let us know if you run into any issues."
exit 1
}
curl_check ()
{
echo "Checking for curl..."
if command -v curl > /dev/null; then
echo "Detected curl..."
else
echo "Installing curl..."
apt-get install -q -y curl
fi
}
install_debian_keyring ()
{
if [ "${os}" = "debian" ]; then
echo "Installing debian-archive-keyring which is needed for installing "
echo "apt-transport-https on many Debian systems."
apt-get install -y debian-archive-keyring &> /dev/null
fi
}
detect_os ()
{
if [[ ( -z "${os}" ) && ( -z "${dist}" ) ]]; then
# some systems dont have lsb-release yet have the lsb_release binary and
# vice-versa
if [ -e /etc/lsb-release ]; then
. /etc/lsb-release
if [ "${ID}" = "raspbian" ]; then
os=${ID}
dist=`cut --delimiter='.' -f1 /etc/debian_version`
else
os=${DISTRIB_ID}
dist=${DISTRIB_CODENAME}
if [ -z "$dist" ]; then
dist=${DISTRIB_RELEASE}
fi
fi
elif [ `which lsb_release 2>/dev/null` ]; then
dist=`lsb_release -c | cut -f2`
os=`lsb_release -i | cut -f2 | awk '{ print tolower($1) }'`
elif [ -e /etc/debian_version ]; then
# some Debians have jessie/sid in their /etc/debian_version
# while others have '6.0.7'
os=`cat /etc/issue | head -1 | awk '{ print tolower($1) }'`
if grep -q '/' /etc/debian_version; then
dist=`cut --delimiter='/' -f1 /etc/debian_version`
else
dist=`cut --delimiter='.' -f1 /etc/debian_version`
fi
else
unknown_os
fi
fi
if [ -z "$dist" ]; then
unknown_os
fi
# remove whitespace from OS and dist name
os="${os// /}"
dist="${dist// /}"
echo "Detected operating system as $os/$dist."
}
main ()
{
detect_os
curl_check
# Need to first run apt-get update so that apt-transport-https can be
# installed
echo -n "Running apt-get update... "
apt-get update &> /dev/null
echo "done."
# Install the debian-archive-keyring package on debian systems so that
# apt-transport-https can be installed next
install_debian_keyring
echo -n "Installing apt-transport-https... "
apt-get install -y apt-transport-https &> /dev/null
echo "done."
gpg_key_url="https://packagecloud.io/github/git-lfs/gpgkey"
apt_config_url="https://packagecloud.io/install/repositories/github/git-lfs/config_file.list?os=${os}&dist=${dist}&source=script"
apt_source_path="/etc/apt/sources.list.d/github_git-lfs.list"
echo -n "Installing $apt_source_path..."
# create an apt config file for this repository
curl -sSf "${apt_config_url}" > $apt_source_path
curl_exit_code=$?
if [ "$curl_exit_code" = "22" ]; then
echo
echo
echo -n "Unable to download repo config from: "
echo "${apt_config_url}"
echo
echo "This usually happens if your operating system is not supported by "
echo "packagecloud.io, or this script's OS detection failed."
echo
echo "You can override the OS detection by setting os= and dist= prior to running this script."
echo "You can find a list of supported OSes and distributions on our website: https://packagecloud.io/docs#os_distro_version"
echo
echo "For example, to force Ubuntu Trusty: os=ubuntu dist=trusty ./script.sh"
echo
echo "If you are running a supported OS, please email [email protected] and report this."
[ -e $apt_source_path ] && rm $apt_source_path
exit 1
elif [ "$curl_exit_code" = "35" ]; then
echo "curl is unable to connect to packagecloud.io over TLS when running: "
echo " curl ${apt_config_url}"
echo "This is usually due to one of two things:"
echo
echo " 1.) Missing CA root certificates (make sure the ca-certificates package is installed)"
echo " 2.) An old version of libssl. Try upgrading libssl on your system to a more recent version"
echo
echo "Contact [email protected] with information about your system for help."
[ -e $apt_source_path ] && rm $apt_source_path
exit 1
elif [ "$curl_exit_code" -gt "0" ]; then
echo
echo "Unable to run: "
echo " curl ${apt_config_url}"
echo
echo "Double check your curl installation and try again."
[ -e $apt_source_path ] && rm $apt_source_path
exit 1
else
echo "done."
fi
echo -n "Importing packagecloud gpg key... "
# import the gpg key
curl -L "${gpg_key_url}" 2> /dev/null | apt-key add - &>/dev/null
echo "done."
echo -n "Running apt-get update... "
# update apt on this system
apt-get update &> /dev/null
echo "done."
echo
echo "The repository is setup! You can now install packages."
}
main
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash
#!/bin/bash
unknown_os ()
{
echo "Unfortunately, your operating system distribution and version are not supported by this script."
echo
echo "You can override the OS detection by setting os= and dist= prior to running this script."
echo "You can find a list of supported OSes and distributions on our website: https://packagecloud.io/docs#os_distro_version"
echo
echo "For example, to force CentOS 6: os=el dist=6 ./script.sh"
echo
echo "Please email [email protected] and let us know if you run into any issues."
exit 1
}
curl_check ()
{
echo "Checking for curl..."
if command -v curl > /dev/null; then
echo "Detected curl..."
else
echo "Installing curl..."
yum install -d0 -e0 -y curl
fi
}
detect_os ()
{
if [[ ( -z "${os}" ) && ( -z "${dist}" ) ]]; then
if [ -e /etc/os-release ]; then
. /etc/os-release
dist=`echo ${VERSION_ID} | awk -F '.' '{ print $1 }'`
os=${ID}
elif [ `which lsb_release 2>/dev/null` ]; then
# get major version (e.g. '5' or '6')
dist=`lsb_release -r | cut -f2 | awk -F '.' '{ print $1 }'`
# get os (e.g. 'centos', 'redhatenterpriseserver', etc)
os=`lsb_release -i | cut -f2 | awk '{ print tolower($1) }'`
elif [ -e /etc/oracle-release ]; then
dist=`cut -f5 --delimiter=' ' /etc/oracle-release | awk -F '.' '{ print $1 }'`
os='ol'
elif [ -e /etc/fedora-release ]; then
dist=`cut -f3 --delimiter=' ' /etc/fedora-release`
os='fedora'
elif [ -e /etc/redhat-release ]; then
os_hint=`cat /etc/redhat-release | awk '{ print tolower($1) }'`
if [ "${os_hint}" = "centos" ]; then
dist=`cat /etc/redhat-release | awk '{ print $3 }' | awk -F '.' '{ print $1 }'`
os='centos'
elif [ "${os_hint}" = "scientific" ]; then
dist=`cat /etc/redhat-release | awk '{ print $4 }' | awk -F '.' '{ print $1 }'`
os='scientific'
else
dist=`cat /etc/redhat-release | awk '{ print tolower($7) }' | cut -f1 --delimiter='.'`
os='redhatenterpriseserver'
fi
else
aws=`grep -q Amazon /etc/issue`
if [ "$?" = "0" ]; then
dist='6'
os='aws'
else
unknown_os
fi
fi
fi
if [[ ( -z "${os}" ) || ( -z "${dist}" ) || ( "${os}" = "opensuse" ) ]]; then
unknown_os
fi
# remove whitespace from OS and dist name
os="${os// /}"
dist="${dist// /}"
echo "Detected operating system as ${os}/${dist}."
}
main ()
{
detect_os
curl_check
yum_repo_config_url="https://packagecloud.io/install/repositories/github/git-lfs/config_file.repo?os=${os}&dist=${dist}&source=script"
yum_repo_path=/etc/yum.repos.d/github_git-lfs.repo
echo "Downloading repository file: ${yum_repo_config_url}"
curl -sSf "${yum_repo_config_url}" > $yum_repo_path
curl_exit_code=$?
if [ "$curl_exit_code" = "22" ]; then
echo
echo
echo -n "Unable to download repo config from: "
echo "${yum_repo_config_url}"
echo
echo "This usually happens if your operating system is not supported by "
echo "packagecloud.io, or this script's OS detection failed."
echo
echo "You can override the OS detection by setting os= and dist= prior to running this script."
echo "You can find a list of supported OSes and distributions on our website: https://packagecloud.io/docs#os_distro_version"
echo
echo "For example, to force CentOS 6: os=el dist=6 ./script.sh"
echo
echo "If you are running a supported OS, please email [email protected] and report this."
[ -e $yum_repo_path ] && rm $yum_repo_path
exit 1
elif [ "$curl_exit_code" = "35" ]; then
echo
echo "curl is unable to connect to packagecloud.io over TLS when running: "
echo " curl ${yum_repo_config_url}"
echo
echo "This is usually due to one of two things:"
echo
echo " 1.) Missing CA root certificates (make sure the ca-certificates package is installed)"
echo " 2.) An old version of libssl. Try upgrading libssl on your system to a more recent version"
echo
echo "Contact [email protected] with information about your system for help."
[ -e $yum_repo_path ] && rm $yum_repo_path
exit 1
elif [ "$curl_exit_code" -gt "0" ]; then
echo
echo "Unable to run: "
echo " curl ${yum_repo_config_url}"
echo
echo "Double check your curl installation and try again."
[ -e $yum_repo_path ] && rm $yum_repo_path
exit 1
else
echo "done."
fi
echo "Installing pygpgme to verify GPG signatures..."
yum install -y pygpgme --disablerepo='github_git-lfs'
pypgpme_check=`rpm -qa | grep -qw pygpgme`
if [ "$?" != "0" ]; then
echo
echo "WARNING: "
echo "The pygpgme package could not be installed. This means GPG verification is not possible for any RPM installed on your system. "
echo "To fix this, add a repository with pygpgme. Usualy, the EPEL repository for your system will have this. "
echo "More information: https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F"
echo
# set the repo_gpgcheck option to 0
sed -i'' 's/repo_gpgcheck=1/repo_gpgcheck=0/' /etc/yum.repos.d/github_git-lfs.repo
fi
echo "Installing yum-utils..."
yum install -y yum-utils --disablerepo='github_git-lfs'
yum_utils_check=`rpm -qa | grep -qw yum-utils`
if [ "$?" != "0" ]; then
echo
echo "WARNING: "
echo "The yum-utils package could not be installed. This means you may not be able to install source RPMs or use other yum features."
echo
fi
echo "Generating yum cache for github_git-lfs..."
yum -q makecache -y --disablerepo='*' --enablerepo='github_git-lfs'
echo
echo "The repository is setup! You can now install packages."
}
main
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.python.sh | bash
#!/bin/bash
curl_check ()
{
echo "Checking for curl..."
if command -v curl > /dev/null; then
echo "Detected curl..."
else
echo "curl could not be found, please install curl and try again"
exit 1
fi
}
virtualenv_check ()
{
if [ -z "$VIRTUAL_ENV" ]; then
echo "Detected VirtualEnv: Please visit https://packagecloud.io/github/git-lfs/install#virtualenv"
fi
}
new_global_section ()
{
echo "No pip.conf found, creating"
mkdir -p "$HOME/.pip"
pip_extra_url > $HOME/.pip/pip.conf
}
edit_global_section ()
{
echo "pip.conf found, making a backup copy, and appending"
cp $HOME/.pip/pip.conf $HOME/.pip/pip.conf.bak
awk -v regex="$(escaped_pip_extra_url)" '{ gsub(/^\[global\]$/, regex); print }' $HOME/.pip/pip.conf.bak > $HOME/.pip/pip.conf
echo "pip.conf appended, backup copy: $HOME/.pip/pip.conf.bak"
}
pip_check ()
{
version=`pip --version`
echo $version
}
abort_already_configured ()
{
if [ -e "$HOME/.pip/pip.conf" ]; then
if grep -q "github/git-lfs" "$HOME/.pip/pip.conf"; then
echo "Already configured pip for this repository, skipping"
exit 0
fi
fi
}
pip_extra_url ()
{
printf "[global]\nextra-index-url=https://packagecloud.io/github/git-lfs/pypi/simple\n"
}
escaped_pip_extra_url ()
{
printf "[global]\\\nextra-index-url=https://packagecloud.io/github/git-lfs/pypi/simple"
}
edit_pip_config ()
{
if [ -e "$HOME/.pip/pip.conf" ]; then
edit_global_section
else
new_global_section
fi
}
main ()
{
abort_already_configured
curl_check
virtualenv_check
pip_check
edit_pip_config
echo "The repository is setup! You can now install packages."
}
main
Jump to section:
If you'd prefer to install your repo on your system manually, follow the instructions below. If you feel something is missing or just want more info, don't hesitate to get in touch.
In order to install a deb repo, first you need to install the GPG key that used to sign repository metadata. You do that using a utility called apt-key.
curl -L https://packagecloud.io/github/git-lfs/gpgkey | sudo apt-key add -
sudo apt-get update
sudo apt-get install debian-archive-keyring
sudo apt-get install -y apt-transport-https
Create a file named /etc/apt/sources.list.d/github_git-lfs.list that contains the repository configuration below.
Make sure to replace ubuntu and trusty in the config below with your Linux distribution and version:
deb https://packagecloud.io/github/git-lfs/ubuntu/ trusty main deb-src https://packagecloud.io/github/git-lfs/ubuntu/ trusty main
Valid options for os and dist parameters can be found in our support OS list in the docs.
sudo apt-get updateto update your local APT cache.
Install pygpgme, a package which allows yum to handle gpg signatures, and a package called yum-utils which contains the tools you need for installing source RPMs.
sudo yum install pygpgme yum-utils
You may need to install the EPEL repository for your system to install these packages. If you do not install pygpgme, GPG verification will not work.
Create a file named /etc/yum.repos.d/github_git-lfs.repo that contains the repository configuration below.
Make sure to replace el and 6 in the config below with your Linux distribution and version:
[github_git-lfs] name=github_git-lfs baseurl=https://packagecloud.io/github/git-lfs/el/6/$basearch repo_gpgcheck=1 enabled=1 gpgkey=https://packagecloud.io/github/git-lfs/gpgkey sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 [github_git-lfs-source] name=github_git-lfs-source baseurl=https://packagecloud.io/github/git-lfs/el/6/SRPMS repo_gpgcheck=1 enabled=1 gpgkey=https://packagecloud.io/github/git-lfs/gpgkey sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300
Valid options for os and dist parameters can be found in our supported OS list in the docs.
yum -q makecache -y --disablerepo='*' --enablerepo='github_git-lfs'
To install gems from this repository, you'll need to add the repository as a source.
gem source --add https://packagecloud.io/github/git-lfs/
To install gems from this repository, you'll need to add it as a source to your Gemfile.
In newer bundler versions, you can scope specific gems to a source, like so:
# Gemfile # Note: It's recommended you add the official https://rubygems.org source, unless your # packagecloud repository can meet all of the dependency requirements in the Gemfile. source "https://rubygems.org" source "https://packagecloud.io/github/git-lfs" do gem "my-gem" gem "another-gem" end
Older versions of Bundler have several bugs around scoping gems to a single source using blocks, so you'll have to add the source globally at the top of the Gemfile.
# Gemfile source "https://rubygems.org" source "https://packagecloud.io/github/git-lfs"
To install python packages from this repository, you'll need to add the repository as a source to pip.
Add the repository to the [global] section in your ~/.pip/pip.conf
[global] extra-index-url=https://packagecloud.io/github/git-lfs/pypi/simple
Note: if you would like pip to use only this repository as a source, replace extra-index-url with index-url
Ensure you are running the latest version of pip inside your virtualenv:
my_virtualenv/bin/pip install --upgrade pip
Add this to the bottom of your requirements.txt
--extra-index-url=https://packagecloud.io/github/git-lfs/pypi/simple
Note: if you would like pip to use only this repository as a source, replace extra-index-url with index-url
If you're looking for further clarification on anything, don't hesitate to get in touch!
If you use chef to manage your infrastructure, you're in luck! We maintain a cookbook that makes it really easy to get up and running.
Using Berkshelf to manage your cookbooks? Depend on our cookbook like this:
cookbook "packagecloud"
If you're managing your cookbooks some other way, you can get our cookbook from supermarket.chef.io or github.
Once you have our cookbook installed, all you have to do to install this repo is add the following block to one of your recipes:
packagecloud_repo "github/git-lfs" do type "deb" # or "rpm" or "gem" end
The LWRP in our cookbook will determine what OS/Version you're on and setup the repository correctly for that particular node. It will also contact our installation API to issue a read token, and make sure our gpg key gets installed if necessary.
If you use puppet to manage your infrastructure, you're in luck! We maintain a module that makes it really easy to get up and running.
You can get our module on Puppet Forge or on GitHub.
To get this repo installed, you just need to add the following to one of your manifests:
include packagecloud
packagecloud::repo { "github/git-lfs":
type => 'rpm', # or "deb" or "gem"
}
The module will determine what OS/Version you're on and setup the repository correctly for that particular node. It will also contact our installation API to issue a read token, and make sure our gpg key gets installed if necessary.
To install gems from this repository, you'll need to add it as a source to your Gemfile.
In newer bundler versions, you can scope specific gems to a source, like so:
# Gemfile # Note: It's recommended you add the official https://rubygems.org source, unless your # packagecloud repository can meet all of the dependency requirements in the Gemfile. source "https://rubygems.org" source "https://packagecloud.io/github/git-lfs" do gem "my-gem" gem "another-gem" end
Older versions of Bundler have several bugs around scoping gems to a single source using blocks, so you'll have to add the source globally at the top of the Gemfile.
# Gemfile source "https://rubygems.org" source "https://packagecloud.io/github/git-lfs"
Ensure you are running the latest version of pip inside your virtualenv:
my_virtualenv/bin/pip install --upgrade pip
Add this to the bottom of your requirements.txt
--extra-index-url=https://packagecloud.io/github/git-lfs/pypi/simple
Note: if you would like pip to use only this repository as a source, replace extra-index-url with index-url