2016-03-01 10:47:41 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-11-30 14:47:44 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CHECK VERSION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD UPGRADE STEPS
|
|
|
|
#=================================================
|
2019-02-26 23:56:20 +01:00
|
|
|
# INSTALL SOURCES
|
2018-11-30 14:47:44 +01:00
|
|
|
#=================================================
|
|
|
|
|
2022-02-04 15:36:57 +01:00
|
|
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
|
|
then
|
2022-02-04 15:41:24 +01:00
|
|
|
ynh_script_progression --message="Upgrading source files..."
|
2022-02-04 15:36:57 +01:00
|
|
|
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-11-02 19:00:22 +01:00
|
|
|
mkdir -p "$install_dir"
|
|
|
|
cp -r ../sources/extra_files/app/* "$install_dir"
|
2022-02-04 15:36:57 +01:00
|
|
|
fi
|
2018-11-30 14:47:44 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC UPGRADE
|
|
|
|
#=================================================
|
|
|
|
# USE THE CONFIG FILE
|
|
|
|
#=================================================
|
|
|
|
|
2023-11-02 19:00:22 +01:00
|
|
|
ynh_replace_string "(no-config)" "config.json" "$install_dir/index.html"
|
2018-11-30 14:47:44 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# COPY THE CONFIG FILE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Copie ou modification d'un fichier de config
|
2023-11-02 19:05:09 +01:00
|
|
|
ynh_add_config --template="config.json" --destination="$install_dir/config.json"
|
2018-11-30 14:47:44 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALISATION
|
|
|
|
#=================================================
|
|
|
|
# SECURING FILES AND DIRECTORIES
|
|
|
|
#=================================================
|
|
|
|
|
2023-11-02 19:00:22 +01:00
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2018-11-30 14:47:44 +01:00
|
|
|
|
|
|
|
#=================================================
|
2021-02-08 09:32:10 +01:00
|
|
|
# END OF SCRIPT
|
2018-11-30 14:47:44 +01:00
|
|
|
#=================================================
|
|
|
|
|
2021-02-08 09:32:10 +01:00
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|