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

clean syntax for scripts with new release helpers in yunohost

This commit is contained in:
Robles Rodolphe 2021-03-29 20:27:48 +02:00
parent 142836f0f3
commit 8a2ff1a1ae
4 changed files with 7 additions and 46 deletions

View file

@ -26,29 +26,17 @@
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": {
"en": "Choose a domain for Garradin",
"fr": "Choisissez un domaine pour Garradin"
},
"example": "domain.org" "example": "domain.org"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": {
"en": "Choose a path for Garradin",
"fr": "Choisissez un chemin pour Garradin"
},
"example": "/garradin", "example": "/garradin",
"default": "/garradin" "default": "/garradin"
}, },
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"help": { "help": {
"en": "The SSO is not implemented for this app and yunohost is not sure for hundred of users...", "en": "The SSO is not implemented for this app and yunohost is not sure for hundred of users...",
"fr": "Le SSO n'est pas implémenté pour cette application et yunohost n'est pas sûr pour une centaine d'utilisateurs..." "fr": "Le SSO n'est pas implémenté pour cette application et yunohost n'est pas sûr pour une centaine d'utilisateurs..."

View file

@ -20,7 +20,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." ynh_print_info "Declaring files to be backed up..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME

View file

@ -33,9 +33,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder" test ! -e "$final_path" || ynh_die "This path already contains a folder"
# Normalize the URL path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Check web path availability # Check web path availability
ynh_webpath_available $domain $path_url ynh_webpath_available $domain $path_url
# Register (book) web path # Register (book) web path

View file

@ -25,8 +25,8 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
if ynh_compare_current_package_version --comparison lt --version 0.9.8.1~ynh1; then 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 O.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 please first connect to your garradin admin page before next update to version 1.0.*" ynh_print_info --message="Sorry your version is outdated and need first an update to version O.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'"
ynh_die "Sorry your version is outdated and need first an update to version O.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 please first connect to your garradin admin page before next update to version 1.0.*" ynh_die "Sorry your version is outdated and need first an update to version O.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'"
else else
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
fi fi
@ -42,28 +42,6 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi fi
### If nobody installed your app before 3.7,
### then you may safely remove these lines
# Cleaning legacy permissions
# is_public=$(ynh_app_setting_get --app=$app --key=is_public)
if [ -n "$is_public" ]; then
# Remove protected_uris
ynh_app_setting_delete --app=$app --key=protected_uris
#Removing skipped/unprotected_uris under certain conditions, remove the visitors group added during the migration process of 3.7
#Remove skipped_uris. If the app was public, add visitors again to the main permission
if ynh_permission_has_user --permission=main --user=visitors
then
ynh_app_setting_delete --app=$app --key=skipped_uris
ynh_permission_update --permission "main" --add "visitors"
else
ynh_app_setting_delete --app=$app --key=skipped_uris
fi
ynh_app_setting_delete --app=$app --key=is_public
fi
#================================================= #=================================================
# Backup Data # Backup Data
#================================================= #=================================================
@ -99,11 +77,7 @@ ynh_abort_if_errors
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=5 ynh_script_progression --message="Upgrading source files..." --weight=5
if [ "$upgrade_type" == "UPGRADE_APP" ] $upgrade_type == "UPGRADE_APP"
then
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -128,7 +102,7 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
# Create a dedicated PHP-FPM config # Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies" ynh_add_fpm_config --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#======================================================= #=======================================================
# backup bdd, squelettes directory and config.local.php # backup bdd, squelettes directory and config.local.php
#======================================================= #=======================================================
@ -140,11 +114,13 @@ backup_squelettes=/tmp/squelettes
if [ -d "$backup_squelettes" ] if [ -d "$backup_squelettes" ]
then then
cp -ar $backup_squelettes $final_path/www/squelettes cp -ar $backup_squelettes $final_path/www/squelettes
rm -r $backup_squelettes
fi fi
if [ -e "$backup_bdd" ] if [ -e "$backup_bdd" ]
then then
cp -a $backup_bdd $final_path/association.sqlite cp -a $backup_bdd $final_path/association.sqlite
rm -r $backup_bdd
fi fi
key=$(ynh_string_random --length=50) key=$(ynh_string_random --length=50)