e2f770c8f5
Updated INSTALL.md Added a numch of small changes so build-centos doesn't fail after running build_rpms, and vice versa. Made compiling rpm with nodeps easier
106 lines
3.0 KiB
Bash
Executable File
106 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# This script works with CentOS 6 or 7
|
|
# The CentOS 5 kernel is too old for go's liking, but this script works on CentOS 5
|
|
|
|
set -eu
|
|
|
|
trap 'echo FAIL' ERR
|
|
|
|
REDHAT_VERSION=($(head -n 1 /etc/redhat-release | \grep -Eo '[0-9]+'))
|
|
|
|
if [[ ${REDHAT_VERSION[0]} == 5 ]]; then
|
|
pushd /tmp
|
|
#Don't know why rpm -Uvh {url} doesn't work... Probably 302
|
|
if ! rpm -q epel-release; then
|
|
yum install -y curl.x86_64 #Centos 5 isn't as smart about not downloading 32 bit
|
|
curl -L -O http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
|
|
rpm -Uvh epel-release-5-4.noarch.rpm
|
|
rm epel-release-5-4.noarch.rpm
|
|
fi
|
|
popd
|
|
yum install -y bison git make man which
|
|
else
|
|
if [[ ${REDHAT_VERSION[0]} == 6 ]]; then
|
|
rpm -q epel-release || rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
|
|
fi
|
|
|
|
yum install -y bison git golang make man which
|
|
fi
|
|
|
|
cd $(dirname ${BASH_SOURCE[0]})
|
|
|
|
if git rev-parse; then
|
|
cd $(git rev-parse --show-toplevel)
|
|
elif [ -e bootstrap ];then
|
|
cd ..
|
|
else
|
|
cd /tmp
|
|
[ -d git-lfs ] || git clone https://github.com/github/git-lfs
|
|
cd git-lfs
|
|
fi
|
|
|
|
if [[ ${REDHAT_VERSION[0]} == 5 ]]; then
|
|
if ! env PATH=${PATH}:`pwd`/go/bin which gofmt > /dev/null 2>&1; then
|
|
yum install -y gcc glibc
|
|
curl -L -O https://storage.googleapis.com/golang/go1.4.2.src.tar.gz
|
|
tar -zxvf go1.4.2.src.tar.gz
|
|
rm go1.4.2.src.tar.gz
|
|
pushd ./go/src
|
|
sed -i 's|.*--build-id.*||' ./cmd/go/build.go
|
|
./make.bash
|
|
#This will have a few failures, but that is expected in CentOS 5
|
|
./run.bash | true
|
|
popd
|
|
fi
|
|
#If go isn't in the path, then it's in the go dir, so add it to the path
|
|
if ! which gofmt > /dev/null 2>&1; then
|
|
export PATH=${PATH}:`pwd`/go/bin
|
|
fi
|
|
fi
|
|
|
|
mkdir -p src/github.com/github
|
|
if [ ! -e "src/github.com/github/git-lfs" ]; then
|
|
ln -s $(pwd) src/github.com/github/git-lfs
|
|
fi
|
|
GOPATH=`pwd` ./script/bootstrap
|
|
|
|
install -D bin/git-lfs /usr/local/bin
|
|
git lfs init
|
|
|
|
if which ruby > /dev/null 2>&1; then
|
|
IFS_OLD=${IFS}
|
|
IFS=.
|
|
RUBY_VERSION=($(ruby -e "print RUBY_VERSION"))
|
|
IFS=${IFS_OLD}
|
|
else
|
|
RUBY_VERSION=(0 0 0) #Thanks -u!
|
|
fi
|
|
|
|
if [[ ${RUBY_VERSION[0]} < 2 ]]; then
|
|
if [[ ${REDHAT_VERSION[0]} < 7 ]]; then
|
|
yum install -y tar
|
|
#if gpg isn't installed, everything actually works. if it is, the key must be added or rvm won't work
|
|
which gpg2 > /dev/null 2>&1 &&
|
|
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
|
|
which gpg > /dev/null 2>&1 &&
|
|
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
|
|
set +e #For CentOS 5
|
|
curl -L get.rvm.io | bash -s stable
|
|
set +u
|
|
source /usr/local/rvm/scripts/rvm
|
|
rvm install ruby
|
|
rvm use ruby
|
|
set -ue
|
|
elif grep -q ' 7' /etc/redhat-release; then
|
|
yum install -y ruby ruby-devel
|
|
fi
|
|
fi
|
|
|
|
gem install ronn
|
|
GOPATH=`pwd` ./script/man
|
|
install -D man/*.1 /usr/local/share/man/man1
|
|
git help lfs > /dev/null
|
|
|
|
echo SUCCESS
|