Commit d1920776 authored by Dave Lane's avatar Dave Lane

adding semaphore to stop composer running twice simultaneously

parent b725e2b9
......@@ -2,23 +2,35 @@
set -e
# run composer to set up dependencies if not already there...
if ! [ -e vendor/autoload.php ]; then
echo >&2 "installing dependencies with Composer"
if ! [ -e /usr/local/bin/composer ]; then
echo >&2 "first getting Composer"
# Get Composer
curl -S https://getcomposer.org/installer | php
chmod a+x composer.phar
mv composer.phar /usr/local/bin/composer
fi
if ! [ -e .git/hooks ]; then
echo >&2 "creating a .git/hooks dir to avoid errors"
mkdir -p .git/hooks
SEMAPH=composer-running
if ! [ -f $SEMAPH ] ; then
# create the semaphore file with the date in it...
date > $SEMAPH
# run composer to set up dependencies if not already there...
if ! [ -e vendor/autoload.php ]; then
echo >&2 "installing dependencies with Composer"
if ! [ -e /usr/local/bin/composer ]; then
echo >&2 "first getting Composer"
# Get Composer
curl -S https://getcomposer.org/installer | php
chmod a+x composer.phar
mv composer.phar /usr/local/bin/composer
fi
if ! [ -e .git/hooks ]; then
echo >&2 "creating a .git/hooks dir to avoid errors"
mkdir -p .git/hooks
fi
composer install
else
echo >&2 "vendor dependencies already in place."
fi
composer install
#remove semaphore
rm $SEMAPH
else
echo >&2 "vendor dependencies already in place."
fi
echo >&2 "Looks like another composer is already running. If not, please remove $SEMAPH"
fi
exec "$@"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment