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

make first this branch equal as master branch

This commit is contained in:
Robles Rodolphe 2021-04-17 15:43:27 +02:00
parent 696d4be07d
commit 76d0ed0a80
4 changed files with 80 additions and 9 deletions

6
conf/0.9.8.src Normal file
View file

@ -0,0 +1,6 @@
SOURCE_URL=https://fossil.kd2.org/garradin/uv/garradin-0.9.8.1.tar.bz2
SOURCE_SUM=7cc64b51c9721c2dd7ee510f245bcfc4693ee07f74581ad74003906eb4716ef1
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.bz2
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -6,7 +6,7 @@
"en": "Software to manage association",
"fr": "Logiciel libre de gestion d'association"
},
"version": "1.0.7~ynh1",
"version": "1.0.7~ynh2",
"url": "http://garradin.eu/a-propos/",
"license": "GPL-3.0-or-later",
"maintainer": {

View file

@ -130,4 +130,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of Garradin completed" --last
ynh_script_progression --message="Installation of Garradin completed" --last

View file

@ -24,13 +24,14 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK VERSION
#=================================================
if ynh_compare_current_package_version --comparison lt --version 0.9.8.1~ynh1; then
ynh_print_info --message="Sorry your version is outdated and need first an update to version 0.9.8.1 with the branch 0.9.8, proceed like that: 'sudo yunohost app upgrade garradin -u https://github.com/YunoHost-Apps/garradin_ynh/tree/0.9.8 --debug' and open your admin page to finalize before next update"
ynh_die "Sorry your version is outdated and need first an update to version 0.9.8.1 with the branch 0.9.8, proceed like that: 'sudo yunohost app upgrade garradin -u https://github.com/YunoHost-Apps/garradin_ynh/tree/0.9.8 --debug' and open your admin page to finalize before next update"
upgrade_type="0.9.8"
else
upgrade_type=$(ynh_check_app_version_changed)
fi
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -66,17 +67,73 @@ ynh_script_progression --message="Backing up Garradin before upgrading (may take
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# UPGRADE TO 0.9.8 if necessary
#=================================================
if [ "$upgrade_type" == "0.9.8" ]
then
ynh_script_progression --message="Upgrading upgrade to 0.9.8" --weight=5
# Download, check integrity, uncompress and patch the source from 0.9.8.src
ynh_setup_source --dest_dir="$final_path" --source_id="0.9.8"
# Set permissions on app files
ynh_system_user_create --username=$app
ynh_add_nginx_config
ynh_add_fpm_config --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
ynh_script_progression --message="restore data..." --weight=10
backup_bdd=/tmp/association.sqlite
backup_squelettes=/tmp/squelettes
if [ -d "$backup_squelettes" ]
then
cp -ar $backup_squelettes $final_path/www/squelettes
ynh_secure_remove $backup_squelettes
fi
if [ -e "$backup_bdd" ]
then
cp -a $backup_bdd $final_path/association.sqlite
ynh_secure_remove $backup_bdd
fi
key=$(ynh_string_random --length=50)
cp -a $final_path/config.dist.php $final_path/config.local.php
ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php"
if [ "$path_url" == "/" ]; then
ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php"
else
ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php"
fi
chown $app:$app $final_path -R
chmod 755 $final_path -R
# Create the visitors permission if needed
if ! ynh_permission_exists --permission "visitors"; then
ynh_permission_create --permission "visitors"
fi
ynh_systemd_action --service_name=nginx --action=reload
#finalyse upgrade
ynh_local_curl "/index.php"
sleep 5
ynh_local_curl "/index.php"
upgrade_type="UPGRADE_APP"
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=5
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
# Download, check integrity, uncompress and patch the source from app.src
@ -115,7 +172,7 @@ ynh_script_progression --message="restore data..." --weight=10
backup_bdd=/tmp/association.sqlite
backup_squelettes=/tmp/squelettes
if [ -d "$backup_squelettes" ]
if [ -d "$backup_squelettes" ]
then
cp -ar $backup_squelettes $final_path/www/squelettes
ynh_secure_remove $backup_squelettes
@ -123,7 +180,7 @@ fi
if [ -e "$backup_bdd" ]
then
cp -a $backup_bdd $final_path/association.sqlite
cp -a $backup_bdd $final_path/association.sqlite
ynh_secure_remove $backup_bdd
fi
@ -161,8 +218,16 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# Finalise Upgrade
#=================================================
ynh_script_progression --message="Finalise upgrade" --weight=1
ynh_local_curl "/admin/index.php"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of Garradin completed" --last
ynh_script_progression --message="Upgrade of Garradin completed" --last