diff --git a/check_process b/check_process index 321fbee..58a918d 100644 --- a/check_process +++ b/check_process @@ -1,10 +1,9 @@ ;; Complete Test -# Comment ignored ; Manifest - domain="domain.tld" (DOMAIN) - path="/poubelle" (PATH) - admin="john" (USER) - is_public=1 (PUBLIC|public=1|private=0) + domain="domain.tld" + path="/poubelle" + admin="john" + is_public=1 password="password" ; Checks pkg_linter=1 @@ -16,11 +15,7 @@ upgrade=1 backup_restore=1 multi_instance=0 - incorrect_path=1 - port_already_use=0 (XXXX) change_url=0 -;;; Levels - Level 5=auto ;;; Options Email= Notification=none diff --git a/manifest.json b/manifest.json index 74892e8..d29ff31 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "misterl56@hotmail.com" }, "requirements": { - "yunohost": ">= 3.5.2" + "yunohost": ">= 4.2.0" }, "multi_instance": false, "services": [ @@ -28,29 +28,17 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for emailpoubelle", - "fr": "Choisissez un domaine pour emailpoubelle" - }, "example": "domain.org" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for emailpoubelle", - "fr": "Choisissez un chemin pour emailpoubelle" - }, "example": "/poubelle", "default": "/poubelle" }, { "name": "admin", "type": "user", - "ask": { - "en": "Choose an admin user for emailpoubelle", - "fr": "Choisissez un administrateur pour emailpoubelle" - }, "example": "homer", "help": { "en": "Admin user can access to the control panel, block and remove all redirection and reset any settings", @@ -60,19 +48,11 @@ { "name": "password", "type": "password", - "ask": { - "en": "Enter a password to access the admin panel", - "fr": "Entrer un mot de passe pour accéder au tableau d'administration" - }, "example": "AveryStrongPassword" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "default": false, "help": { "en": "The app can be accessed outside Yunohost and anyone will be able to create a trash email adress", diff --git a/scripts/_common.sh b/scripts/_common.sh index f1cb75a..d444f3f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,6 +1,7 @@ #================================================= # COMMON VARIABLES #================================================= + pkg_dependencies="php-geoip php7.0-cli" app="emailpoubelle" lang="fr_FR.UTF-8 en_US.UTF-8 it_IT.UTF-8" diff --git a/scripts/backup b/scripts/backup index d640ec4..fec8f07 100644 --- a/scripts/backup +++ b/scripts/backup @@ -7,11 +7,7 @@ #================================================= # IMPORT GENERIC HELPERS #================================================= -#if [ ! -e _common.sh ]; then -# # Get the _common.sh file if it's not in the current directory -# cp ../settings/scripts/_common.sh ./_common.sh -# chmod a+rx _common.sh -#fi + source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -25,7 +21,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -38,35 +34,30 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Backing up the MySQL database..." ynh_mysql_dump_db "$db_name" > db.sql #================================================= # BACKUP THE CRON FILE #================================================= -ynh_script_progression --message="Backing up cron configuration..." ynh_backup --src_path="/etc/cron.d/$app" #================================================= # BACKUP postfix conf #================================================= -ynh_script_progression --message="Backing up postfix conf configuration..." ynh_backup "/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle" @@ -74,4 +65,4 @@ ynh_backup "/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle" # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index e52c69f..e2e694f 100644 --- a/scripts/install +++ b/scripts/install @@ -26,6 +26,7 @@ db_user=emailPoubelle # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= ynh_script_progression --message="Validating installation parameters..." --weight=1 + final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -80,7 +81,6 @@ ln -s $final_path/lang/fr $final_path/lang/fr_FR ln -s $final_path/lang/it $final_path/lang/it_IT ln -s $final_path/www/template-exemple $final_path/template-exemple - #=============================================== #SETTINGS & DATABASE #=============================================== @@ -142,12 +142,12 @@ ynh_add_nginx_config #================================================= # SETUP SSOWAT #================================================= +ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set $app unprotected_uris "/" + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/remove b/scripts/remove index 590b955..2afb261 100644 --- a/scripts/remove +++ b/scripts/remove @@ -21,8 +21,6 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) - - #================================================= # REMOVE THE MYSQL DATABASE #================================================= @@ -41,7 +39,6 @@ ynh_script_progression --message="Removing dependencies..." # Remove metapackage and its dependencies ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -50,7 +47,6 @@ ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -59,7 +55,6 @@ ynh_script_progression --message="Removing nginx web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config - #================================================= # SPECIFIC REMOVE #================================================= diff --git a/scripts/restore b/scripts/restore index 68cfa32..0279e57 100644 --- a/scripts/restore +++ b/scripts/restore @@ -7,11 +7,7 @@ #================================================= # IMPORT GENERIC HELPERS #================================================= -#if [ ! -e _common.sh ]; then -# # Get the _common.sh file if it's not in the current directory -# cp ../settings/scripts/_common.sh ./_common.sh -# chmod a+rx _common.sh -#fi + source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -87,7 +83,6 @@ for i in $lang ; do done locale-gen - #================================================= # RESTORE POSTFIX ALIASES #================================================= @@ -126,4 +121,4 @@ ynh_systemd_action --service_name=postfix --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last \ No newline at end of file +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index ac92353..b12bf12 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,27 +25,12 @@ db_name=$(ynh_app_setting_get $app db_name) # CHECK VERSION #================================================= -### This helper will compare the version of the currently installed app and the version of the upstream package. -### $upgrade_type can have 2 different values -### - UPGRADE_APP if the upstream app version has changed -### - UPGRADE_PACKAGE if only the YunoHost package has changed -### ynh_check_app_version_changed will stop the upgrade if the app is up to date. -### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. -### Not used yet in this script upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi # If db_name doesn't exist, create it if [ -z "$db_name" ]; then @@ -59,6 +44,12 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -73,14 +64,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors - -#================================================= -# CHECK THE PATH -#================================================= -# Normalize the URL path syntax -path_url=$(ynh_normalize_url_path $path_url) - - #================================================= #check for matlink's version - DEPRECATED - uninstall & reinstall #================================================= @@ -140,6 +123,7 @@ ynh_add_nginx_config # UPGRADE DEPENDENCIES #================================================= ynh_script_progression --message="Upgrading dependencies..." + ynh_install_app_dependencies $pkg_dependencies #================================================= @@ -191,7 +175,6 @@ yunohost tools regen-conf postfix -f chown -R www-data:www-data $final_path chown root:root /etc/cron.d/$app - #================================================= # RELOAD SERVICES #================================================= @@ -205,4 +188,3 @@ ynh_script_progression --message="Reloading postfix..." ynh_systemd_action --service_name=postfix --action=reload ynh_script_progression --message="Upgrade of $app completed" --last -