MonarcAppFO/scripts/update-all.sh

121 lines
2.9 KiB
Bash
Raw Normal View History

2016-04-27 16:59:05 +02:00
#!/bin/bash
pull_if_exists() {
if [ -d $1 ]; then
pushd $1
git pull
popd
fi
}
gitcommand=`command -v git`
if [[ -z "$gitcommand" ]]; then
echo "Git must be installed"
exit
fi
$gitcommand pull
2016-04-27 16:59:05 +02:00
composercommand=`command -v composer`
if [[ -z "$composercommand" ]]; then
if [[ ! -f "composer.phar" ]]; then
# https://getcomposer.org/download/
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
fi
php composer.phar update -o
else
$composercommand update -o
fi
2016-04-27 16:59:05 +02:00
currentPath=`pwd`
pathCore="module/MonarcCore"
if [ -d $pathCore ]; then
pull_if_exists $pathCore
else
pathCore="vendor/monarc/core"
fi
pathBO="module/MonarcBO"
if [ -d $pathBO ]; then
pull_if_exists $pathBO
else
pathBO="vendor/monarc/backoffice"
fi
pathFO="module/MonarcFO"
if [ -d $pathFO ]; then
pull_if_exists $pathFO
else
pathFO="vendor/monarc/frontoffice"
fi
if [[ -d node_modules && -d node_modules/ng_anr ]]; then
if [[ -d node_modules/ng_anr/.git ]]; then
pull_if_exists node_modules/ng_backoffice
pull_if_exists node_modules/ng_client
pull_if_exists node_modules/ng_anr
else
npm update
fi
else
npm install
fi
2016-04-27 16:59:05 +02:00
if [ -d $pathCore ]; then
/opt/php-7.0.5/bin/php ./vendor/robmorgan/phinx/bin/phinx migrate -c ./$pathCore/migrations/phinx.php
if [ -d "${pathCore}/hooks" ]; then
cd $pathCore/.git/hooks
ln -s ../../hooks/pre-commit.sh pre-commit 2>/dev/null
chmod u+x pre-commit
cd $currentPath
fi
2016-09-08 10:16:19 +02:00
fi
if [ -d $pathBO ]; then
/opt/php-7.0.5/bin/php ./vendor/robmorgan/phinx/bin/phinx migrate -c ./$pathBO/migrations/phinx.php
2016-09-08 10:16:19 +02:00
if [ -d "${pathBO}/hooks" ]; then
cd $pathBO/.git/hooks
2016-09-08 10:16:19 +02:00
ln -s ../../hooks/pre-commit.sh pre-commit 2>/dev/null
chmod u+x pre-commit
cd $currentPath
2016-09-08 10:16:19 +02:00
fi
2016-08-25 15:42:05 +02:00
fi
if [ -d $pathFO ]; then
/opt/php-7.0.5/bin/php ./vendor/robmorgan/phinx/bin/phinx migrate -c ./$pathFO/migrations/phinx.php
2016-09-08 10:16:19 +02:00
if [ -d "$pathFO/hooks" ]; then
cd $pathFO/.git/hooks
2016-09-08 10:16:19 +02:00
ln -s ../../hooks/pre-commit.sh pre-commit 2>/dev/null
chmod u+x pre-commit
cd $currentPath
2016-09-08 10:16:19 +02:00
fi
2016-08-25 15:42:05 +02:00
fi
2016-04-27 16:59:05 +02:00
if [ -d node_modules/ng_backoffice ]; then
cd node_modules/ng_backoffice
npm install
cd ../..
fi
2016-08-25 15:42:05 +02:00
if [ -d node_modules/ng_client ]; then
cd node_modules/ng_client
npm install
cd ../..
fi
2016-04-27 16:59:05 +02:00
./scripts/link_modules_resources.sh
./scripts/compile_translations.sh
# Clear doctrine cache
/opt/php-7.0.5/bin/php ./public/index.php orm:clear-cache:metadata
/opt/php-7.0.5/bin/php ./public/index.php orm:clear-cache:query
/opt/php-7.0.5/bin/php ./public/index.php orm:clear-cache:result
2016-12-16 16:31:24 +01:00
# Clear ZF2 cache
touch ./data/cache/upgrade && chmod 777 ./data/cache/upgrade