amxmodx/support/checkout-deps.sh

98 lines
2.2 KiB
Bash
Raw Normal View History

2014-02-13 04:46:19 +00:00
#!/usr/bin/env bash
trap "exit" INT
if [ ! -d "amxmodx" ]; then
git clone https://github.com/alliedmodders/amxmodx.git
fi
2014-07-27 09:31:19 +00:00
if [ "$1" != "--no-mysql" ]; then
ismac=0
iswin=0
archive_ext=tar.gz
decomp="tar zxf"
2014-02-13 04:46:19 +00:00
2014-07-27 09:31:19 +00:00
if [ `uname` = "Darwin" ]; then
ismac=1
elif [ `uname` != "Linux" ] && [ -n "${COMSPEC:+1}" ]; then
iswin=1
archive_ext=zip
decomp=unzip
fi
if [ $ismac -eq 1 ]; then
mysqlver=mysql-5.5.28-osx10.5-x86
mysqlurl=http://cdn.mysql.com/archives/mysql-5.5/$mysqlver.$archive_ext
elif [ $iswin -eq 1 ]; then
mysqlver=mysql-noinstall-5.0.24a-win32
mysqlurl=http://cdn.mysql.com/archives/mysql-5.0/$mysqlver.$archive_ext
# The folder in the zip archive does not contain the substring "-noinstall", so strip it
mysqlver=${mysqlver/-noinstall}
2014-02-13 04:46:19 +00:00
else
2014-07-27 09:31:19 +00:00
mysqlver=mysql-5.6.15-linux-glibc2.5-i686
mysqlurl=http://cdn.mysql.com/archives/mysql-5.6/$mysqlver.$archive_ext
fi
if [ ! -d "mysql-5.0" ]; then
if [ `command -v wget` ]; then
wget $mysqlurl -O mysql.$archive_ext
elif [ `command -v curl` ]; then
curl -o mysql.$archive_ext $mysqlurl
else
echo "Failed to locate wget or curl. Install one of these programs to download MySQL."
exit 1
fi
$decomp mysql.$archive_ext
mv $mysqlver mysql-5.0
rm mysql.$archive_ext
2014-02-13 04:46:19 +00:00
fi
fi
checkout ()
{
if [ ! -d "$name" ]; then
2014-05-26 23:21:20 +00:00
git clone $repo -b $branch $name
if [ -n "$origin" ]; then
cd $name
git remote rm origin
git remote add origin $origin
cd ..
fi
2014-02-13 04:46:19 +00:00
else
cd $name
2014-05-26 23:21:20 +00:00
git checkout $branch
git pull origin $branch
2014-02-13 04:46:19 +00:00
cd ..
fi
}
name=metamod-am
2014-05-26 23:21:20 +00:00
branch=master
repo="https://github.com/alliedmodders/metamod-hl1"
origin=
2014-02-13 04:46:19 +00:00
checkout
name=hlsdk
2014-05-26 23:21:20 +00:00
branch=master
repo="https://github.com/alliedmodders/hlsdk"
origin=
2014-02-13 04:46:19 +00:00
checkout
`python -c "import ambuild2"`
if [ $? -eq 1 ]; then
2014-05-26 23:21:20 +00:00
repo="https://github.com/alliedmodders/ambuild"
origin=
branch=master
2014-02-13 04:46:19 +00:00
name=ambuild
checkout
2014-05-26 23:21:20 +00:00
2014-02-13 04:46:19 +00:00
cd ambuild
if [ $iswin -eq 1 ]; then
python setup.py install
else
python setup.py build
echo "About to install AMBuild - press Ctrl+C to abort, otherwise enter your password for sudo."
sudo python setup.py install
fi
fi