1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/flarum_ynh.git synced 2024-09-03 18:36:24 +02:00

Merge pull request #29 from polytan02/patch-5

Store composer in /opt
This commit is contained in:
Titus PiJean 2017-02-22 18:58:34 +01:00 committed by GitHub
commit ba1394f16b
4 changed files with 19 additions and 4 deletions

View file

@ -13,6 +13,12 @@ source /usr/share/yunohost/helpers
# Note: the last argument is where to save this path, see the restore script. # Note: the last argument is where to save this path, see the restore script.
ynh_backup "/var/www/${app}" "sources" ynh_backup "/var/www/${app}" "sources"
# Backup of composer
#
# TO BE VALIDATED AND TESTED
ynh_backup "/opt/flarum_composer" "flarum_composer"
ynh_backup "/usr/local/bin/composer" "local_composer"
### MySQL ### ### MySQL ###
# If a MySQL database is used: # If a MySQL database is used:
# # Dump the database # # Dump the database

View file

@ -59,9 +59,9 @@ sudo chown -R www-data:www-data $tmp
sudo chmod -R 755 $tmp sudo chmod -R 755 $tmp
# Prepare composer and cache directories # Prepare composer and cache directories
sudo mkdir -p /var/www/.composer/cache sudo mkdir -p /opt/flarum_composer/cache
sudo chown -R www-data:www-data /var/www/.composer sudo chown -R www-data:www-data /opt/flarum_composer
sudo chmod -R 755 /var/www/.composer sudo chmod -R 755 /opt/flarum_composer
### composer ### ### composer ###
if ! type "composer" > /dev/null; then if ! type "composer" > /dev/null; then
@ -71,7 +71,7 @@ if ! type "composer" > /dev/null; then
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', '$tmp/composer-setup.php');") ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', '$tmp/composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" = "$ACTUAL_SIGNATURE" ] if [ "$EXPECTED_SIGNATURE" = "$ACTUAL_SIGNATURE" ]
then then
sudo su - root -c "grep -q -F 'env[COMPOSER_HOME]= /var/www/.composer' /etc/php5/fpm/php-fpm.conf || sudo echo 'env[COMPOSER_HOME]= /var/www/.composer' >> /etc/php5/fpm/php-fpm.conf" sudo su - root -c "grep -q -F 'env[COMPOSER_HOME]= /opt/flarum_composer' /etc/php5/fpm/php-fpm.conf || sudo echo 'env[COMPOSER_HOME]= /opt/flarum_composer' >> /etc/php5/fpm/php-fpm.conf"
sudo service php5-fpm reload sudo service php5-fpm reload
sudo su - www-data -s /bin/bash -c "php $tmp/composer-setup.php --install-dir=$tmp --filename=composer" sudo su - www-data -s /bin/bash -c "php $tmp/composer-setup.php --install-dir=$tmp --filename=composer"
sudo mv $tmp/composer /usr/local/bin sudo mv $tmp/composer /usr/local/bin

View file

@ -12,6 +12,8 @@ domain=$(ynh_app_setting_get "$app" domain)
# Remove sources # Remove sources
sudo rm -rf /tmp/composerinstall sudo rm -rf /tmp/composerinstall
sudo rm -rf /var/www/$app sudo rm -rf /var/www/$app
sudo rm -rf /opt/flarum_composer
sudo rm -rf /usr/local/bin/composer
# Remove nginx configuration file # Remove nginx configuration file
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf

View file

@ -24,6 +24,13 @@ sudo yunohost app checkurl "${domain}${path}" -a "$app" \
src_path="/var/www/${app}" src_path="/var/www/${app}"
sudo cp -a ./sources "$src_path" sudo cp -a ./sources "$src_path"
# Restore composer
#
# TO BE TESTED AND VALIDATED
#
cp -a ./flarum_composer /opt/flarum_composer
cp -a ./local_composer /usr/local/bin/composer
# Restore permissions to app files # Restore permissions to app files
# you may need to make some file and/or directory writeable by www-data (nginx user) # you may need to make some file and/or directory writeable by www-data (nginx user)
sudo chown -R root: "$src_path" sudo chown -R root: "$src_path"