2015-08-23 17:33:13 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-02-17 13:02:11 +01:00
|
|
|
source .fonctions # Charge les fonctions génériques habituellement utilisées dans le script
|
2015-08-23 17:33:13 +02:00
|
|
|
|
2017-02-17 13:02:11 +01:00
|
|
|
# Récupère les infos de l'application.
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2015-08-23 17:33:13 +02:00
|
|
|
|
2017-02-17 13:02:11 +01:00
|
|
|
# Source app helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
|
|
path=$(ynh_app_setting_get $app path)
|
|
|
|
final_path=$(ynh_app_setting_get $app final_path)
|
|
|
|
upload=$(ynh_app_setting_get $app upload)
|
|
|
|
|
|
|
|
CHECK_PATH # Vérifie et corrige la syntaxe du path.
|
|
|
|
|
2017-07-17 01:37:27 +02:00
|
|
|
# Make backup of old app folder and create again the app folder
|
|
|
|
sudo mv ${final_path} ${final_path}.old
|
|
|
|
sudo mkdir -p $final_path
|
|
|
|
|
|
|
|
|
2017-02-17 13:02:11 +01:00
|
|
|
# We download the sources and check the md5sum
|
|
|
|
# 1 - hubzilla
|
|
|
|
hubzilla_file=`sudo cat ../sources/hubzilla/source_file`;
|
2017-02-17 14:04:56 +01:00
|
|
|
sudo wget -nv -i ../sources/hubzilla/source_url -O ${hubzilla_file}.zip
|
2017-02-17 13:02:11 +01:00
|
|
|
sudo md5sum -c ../sources/hubzilla/source_md5 --status || (echo "Corrupt source" >&2 && false)
|
2017-02-17 14:47:52 +01:00
|
|
|
sudo unzip -q ${hubzilla_file}.zip -d ../sources/hubzilla/
|
2017-02-17 14:04:56 +01:00
|
|
|
sudo cp -r ../sources/hubzilla/${hubzilla_file}/. $final_path
|
2017-07-17 01:37:27 +02:00
|
|
|
sudo cp -a ${final_path}.old/store ${final_path}
|
2017-07-20 08:06:02 +02:00
|
|
|
sudo cp -a ${final_path}.old/.htconfig.php ${final_path}
|
2017-07-17 01:37:27 +02:00
|
|
|
sudo rm -Rf ${final_path}.old
|
2017-02-17 14:04:56 +01:00
|
|
|
|
2017-02-17 13:02:11 +01:00
|
|
|
# 2 - Addons
|
|
|
|
addons_file=`sudo cat ../sources/hubzilla-addons/source_file`;
|
2017-02-17 14:04:56 +01:00
|
|
|
sudo wget -nv -i ../sources/hubzilla-addons/source_url -O ${addons_file}.zip
|
2017-02-17 13:02:11 +01:00
|
|
|
sudo md5sum -c ../sources/hubzilla-addons/source_md5 --status || (echo "Corrupt source" >&2 && false)
|
2017-02-17 14:47:52 +01:00
|
|
|
sudo unzip -q ${addons_file}.zip -d ../sources/hubzilla-addons/
|
2017-02-17 14:04:56 +01:00
|
|
|
sudo mkdir $final_path/addon
|
|
|
|
sudo cp -r ../sources/hubzilla-addons/${addons_file}/. $final_path/addon
|
|
|
|
|
2017-02-17 13:02:11 +01:00
|
|
|
# 3 - some extra folders
|
|
|
|
sudo chmod -R 777 $final_path/store
|
|
|
|
|
|
|
|
|
2015-08-23 17:33:13 +02:00
|
|
|
|
|
|
|
# Set www-data to owner
|
2017-02-17 13:02:11 +01:00
|
|
|
sudo chown -R www-data:www-data $final_path
|
2015-08-23 17:33:13 +02:00
|
|
|
|
|
|
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
|
|
|
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
|
2017-02-17 13:02:11 +01:00
|
|
|
sed -i "s@YNH_WWW_ALIAS@$final_path@g" ../conf/nginx.conf
|
2017-02-19 14:31:10 +01:00
|
|
|
sed -i "s@UPLOADTOCHANGE@$upload@g" ../conf/nginx.conf
|
2017-02-17 13:02:11 +01:00
|
|
|
nginxconf=/etc/nginx/conf.d/$domain.d/$app.conf
|
|
|
|
sudo cp ../conf/nginx.conf $nginxconf
|
|
|
|
sudo chown root: $nginxconf
|
|
|
|
sudo chmod 600 $nginxconf
|
|
|
|
|
2017-02-19 14:44:33 +01:00
|
|
|
# Dedicated php-fpm
|
2017-02-17 13:02:11 +01:00
|
|
|
sed -i "s@UPLOADTOCHANGE@$upload@g" ../conf/php-fpm.conf
|
2017-02-17 14:09:39 +01:00
|
|
|
sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
|
2017-02-17 13:02:11 +01:00
|
|
|
phpfpmconf=/etc/php5/fpm/pool.d/$app.conf
|
|
|
|
sudo cp ../conf/php-fpm.conf $phpfpmconf
|
|
|
|
sudo chown root: $phpfpmconf
|
2015-08-23 17:33:13 +02:00
|
|
|
|
2017-02-17 13:02:11 +01:00
|
|
|
# Set up poller
|
|
|
|
sed -i "s@YNH_WWW_PATH@$final_path@g" ../conf/poller-cron
|
|
|
|
sudo cp ../conf/poller-cron /etc/cron.d/$app
|
2017-02-11 02:05:28 +01:00
|
|
|
|
2017-07-22 00:24:08 +02:00
|
|
|
# Make app public
|
|
|
|
ynh_app_setting_set $app skipped_uris "/"
|
2015-08-23 17:33:13 +02:00
|
|
|
|
2017-02-17 13:02:11 +01:00
|
|
|
# Reload services
|
2017-02-17 21:55:01 +01:00
|
|
|
sudo service php5-fpm reload || true
|
2017-02-17 13:02:11 +01:00
|
|
|
sudo service nginx reload || true
|
2015-08-23 17:33:13 +02:00
|
|
|
sudo yunohost app ssowatconf
|