caisse-bliss/nope/install.sh

86 lines
2.5 KiB
Bash
Raw Normal View History

2019-05-11 15:27:46 +02:00
2018-04-04 16:25:25 +02:00
#!/bin/bash
2018-08-23 15:36:36 +02:00
echo "################################";
2018-08-29 11:08:05 +02:00
echo "start UPDATE of symfony project";
2018-08-23 15:36:36 +02:00
echo "################################";
2018-08-29 11:08:05 +02:00
echo " ";
echo "####### fix file permissions ######";
2018-08-28 14:53:05 +02:00
2018-08-29 11:08:05 +02:00
`which setfacl` > TEST
2019-05-11 15:27:46 +02:00
if [ echo $TEST == 'acl not found' ]||[ echo $TEST == 'acl non trouvé' ]; then
2018-08-29 11:08:05 +02:00
echo "acl is not installed"
sudo apt install acl -y
exit
else
echo "acl est bien là"
acl -v
fi
2018-08-28 14:53:05 +02:00
HTTPDUSER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1)
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var
2018-08-29 11:08:05 +02:00
echo "####### phpunit test suite ######";
`which phpunit` > TEST
2019-05-11 15:27:46 +02:00
if [ echo $TEST == 'phpunit not found' ]||[ echo $TEST == 'phpunit non trouvé' ]; then
2018-08-29 11:08:05 +02:00
echo "phpunit is not installed"
sudo apt install phpunit -y
exit
else
echo "phpunit est bien là"
phpunit -v
fi
echo "####### node packages ######";
`which npm` > TEST
2019-05-11 15:27:46 +02:00
if [ echo $TEST == 'npm not found' ]||[ echo $TEST == 'npm non trouvé' ]; then
2018-08-29 11:08:05 +02:00
echo "npm is not installed"
sudo apt install npm -y
exit
else
echo "npm est bien là"
npm -v
fi
2018-08-28 14:53:05 +02:00
2018-04-04 16:25:25 +02:00
2018-08-29 11:08:05 +02:00
`which yarn` > TEST
2019-05-11 15:27:46 +02:00
if [ echo $TEST == 'yarn not found' ]||[ echo $TEST == 'yarn non trouvé' ]; then
2018-08-29 11:08:05 +02:00
echo "yarn is not installed"
sudo npm i -g yarn
exit
else
echo "yarn est bien là"
yarn -v
2019-05-11 15:27:46 +02:00
2018-08-29 11:08:05 +02:00
echo "####### build front end with yarn ######";
yarn
yarn run encore production
fi
2018-08-28 14:53:05 +02:00
2018-08-29 11:08:05 +02:00
echo "####### symfony vendor packages ######";
2018-08-28 14:53:05 +02:00
2018-08-29 11:08:05 +02:00
`which composer` > TEST
if [ echo $TEST == 'composer not found' ]; then
echo "composer is not installed"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
exit
else
echo "composer est bien là"
composer -v
composer self-update
composer update
fi
2018-04-04 16:25:25 +02:00
2018-08-29 11:08:05 +02:00
echo "####### symfony database ######";
2018-04-04 16:25:25 +02:00
php bin/console doctrine:schema:update --dump-sql
php bin/console doctrine:schema:update --force
2018-08-29 11:08:05 +02:00
php bin/console cache:clear -eprod
php bin/console cache:warmup -eprod
2018-08-23 15:36:36 +02:00
echo "################################";
2018-08-29 11:08:05 +02:00
echo "end UPDATE of symfony project";
echo "################################";