diff --git a/conf/app-upgrade.src b/conf/app-upgrade.src index 4b4f7e1..57b87c0 100644 --- a/conf/app-upgrade.src +++ b/conf/app-upgrade.src @@ -3,4 +3,3 @@ SOURCE_SUM=5a4b543ff62fed497a0e0c429389cd730df1cc59327567df02c3dff834af069a SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= diff --git a/conf/app.src b/conf/app.src index cbf2029..32a9a89 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,4 +3,3 @@ SOURCE_SUM=6ee7e6d0008dbbad448718ecd2d714173a1f4e17698805621e1cd1a6e802eb75 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= diff --git a/conf/nginx.conf b/conf/nginx.conf index a467dc9..348e2ca 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -3,9 +3,6 @@ location __PATH__/ { alias __FINALPATH__/; index index.php; - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } client_max_body_size 30m; # Add headers to serve security related headers diff --git a/manifest.json b/manifest.json index 1e96557..164f127 100644 --- a/manifest.json +++ b/manifest.json @@ -37,7 +37,7 @@ } ], "requirements": { - "yunohost": ">= 4.1.0" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ @@ -47,8 +47,7 @@ "install": [ { "name": "domain", - "type": "domain", - "example": "example.org" + "type": "domain" }, { "name": "path", @@ -58,8 +57,7 @@ }, { "name": "admin", - "type": "user", - "example": "johndoe" + "type": "user" }, { "name": "is_public", diff --git a/scripts/_common.sh b/scripts/_common.sh index bf92cbd..f10bf59 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,22 +8,8 @@ YNH_PHP_VERSION="7.3" # dependencies used by the app -extra_php_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap" +pkg_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap" #================================================= # EXPERIMENTAL HELPERS #================================================= - -# Execute a command as another user -# usage: exec_as USER COMMAND [ARG ...] -exec_as() { - local USER=$1 - shift 1 - - if [[ $USER = $(whoami) ]] - then - eval $@ - else - sudo -u "$USER" $@ - fi -} diff --git a/scripts/install b/scripts/install index a039141..3e4e7e4 100644 --- a/scripts/install +++ b/scripts/install @@ -51,6 +51,13 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=language --value=$language +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=1 + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # CREATE DEDICATED USER #================================================= @@ -108,8 +115,8 @@ ynh_script_progression --message="Installing and configuring LDAP plugin..." --w ynh_setup_source --dest_dir="$final_path/user/plugins/login-ldap" --source_id="ldap" # Preparing config -exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap" -exec_as $app touch "$final_path/user/accounts/admin.yaml" +ynh_exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap" +ynh_exec_as $app touch "$final_path/user/accounts/admin.yaml" # Setting up config ynh_add_config --template="../conf/login-ldap.yaml" --destination="$final_path/user/config/plugins/login-ldap.yaml" diff --git a/scripts/remove b/scripts/remove index 4999b4f..f9d63cd 100644 --- a/scripts/remove +++ b/scripts/remove @@ -61,6 +61,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2 # Remove the dedicated php-fpm config ynh_remove_fpm_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=1 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index bcdb3a1..4979abc 100644 --- a/scripts/restore +++ b/scripts/restore @@ -40,8 +40,7 @@ fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS @@ -90,8 +89,13 @@ ynh_restore_file --origin_path="/etc/cron.d/$app" # Restore the file first, so it can have a backup if different ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" -# Recreate a dedicated php-fpm config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 08c490e..01c15e5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -115,6 +115,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated nginx config ynh_add_nginx_config +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=1 + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # CREATE DEDICATED USER #================================================= @@ -146,8 +153,8 @@ ynh_script_progression --message="Installing and configuring LDAP plugin..." --w # Download LDAP source ynh_setup_source --dest_dir="$final_path/user/plugins/login-ldap" --source_id="ldap" -exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap" -exec_as $app touch "$final_path/user/accounts/admin.yaml" +ynh_exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap" +ynh_exec_as $app touch "$final_path/user/accounts/admin.yaml" ynh_add_config --template="../conf/login-ldap.yaml" --destination="$final_path/user/config/plugins/login-ldap.yaml" chown $app:$app "$final_path/user/config/plugins/login-ldap.yaml"