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

73 lines
2 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path)
CHECK_PATH # Vérifie et corrige la syntaxe du path.
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Make backup of old app folder and create again the app folder
sudo mv ${final_path} ${final_path}.old
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
sudo cp -a ${final_path}.old/.htconfig.php ${final_path}
sudo rm -Rf ${final_path}.old
#Copy Addons
addons_file=`sudo cat ../conf/friendica-addons/source_file`;
sudo wget -nv -i ../conf/friendica-addons/source_url -O ${addons_file}.zip
sudo md5sum -c ../conf/friendica-addons/source_md5 --status || (echo "Corrupt source" >&2 && false)
sudo unzip -q ${addons_file}.zip -d ../conf/friendica-addons/
sudo mkdir $final_path/addon
sudo cp -r ../conf/friendica-addons/${addons_file}/. $final_path/addon
# 3 - some extra folders
sudo chmod -R 777 $final_path/view/smarty3
# Set www-data to owner
sudo chown -R www-data:www-data $final_path
# Create a dedicated nginx config
ynh_add_nginx_config
# configure friendica
# Set up poller
sed -i "s@YNH_WWW_PATH@$final_path@g" ../conf/poller-cron
sudo cp ../conf/poller-cron /etc/cron.d/$app
ynh_app_setting_set $app skipped_uris "/"
# Reload services
sudo service php5-fpm reload || true
sudo service nginx reload || true
sudo yunohost app ssowatconf