diff --git a/check_process b/check_process index 08dd561..69826b3 100644 --- a/check_process +++ b/check_process @@ -1,8 +1,3 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) @@ -17,7 +12,8 @@ setup_private=0 setup_public=1 upgrade=1 - upgrade=0 from_commit=CommitHash + # 5.7~ynh1 + upgrade=1 from_commit=81d1f5dc1a42305d8cf3a6264176838d0164bfdb backup_restore=1 multi_instance=1 port_already_use=0 @@ -25,8 +21,3 @@ ;;; Options Email= Notification=none -;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. - manifest_arg=domain=DOMAIN& - diff --git a/conf/app.src b/conf/app.src index e4d9a10..d93e58f 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,5 +3,5 @@ SOURCE_SUM=0c7ca3f7fa94d298c4ffb9d342b33e31cf6e93015602227b94924e3237b5ce79 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=LanguageTool-5.7.zip +SOURCE_FILENAME= SOURCE_EXTRACT=true diff --git a/doc/.gitkeep b/doc/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..4d0506b --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +LanguageTool is a multilingual grammar, style, and spell checker. This package provides the API server for use by other programs, like the LanguageTool extensions for browsers and word processors. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..1649db2 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1 @@ +LanguageTool est un correcteur d'orthographe, de grammaire et de style multilingue. Ce paquet fournit le serveur API pour utilisation depuis d'autres programmes, comme les extensions LangageTool pour navigateurs et logiciels de bureautique. diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..9e4f8bc --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,3 @@ +## Configuration + +There is a configuration file at `/opt/yunohost/languagetool/languagetool.conf` (for the first install). diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..4708023 --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -0,0 +1,3 @@ +## Configuration + +Il y a un fichier de configuration à `/opt/yunohost/languagetool/languagetool.conf` (pour la première installation). diff --git a/doc/screenshots/.gitkeep b/doc/screenshots/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/screenshot.png b/doc/screenshots/screenshot.png similarity index 100% rename from screenshot.png rename to doc/screenshots/screenshot.png diff --git a/screenshot_fr.png b/doc/screenshots/screenshot_fr.png similarity index 100% rename from screenshot_fr.png rename to doc/screenshots/screenshot_fr.png diff --git a/manifest.json b/manifest.json index a7821e9..6d62c0b 100644 --- a/manifest.json +++ b/manifest.json @@ -6,15 +6,22 @@ "en": "Multilingual grammar, style, and spell checker (API)", "fr": "Correcteur d'orthographe, de grammaire et de style multilingue (API)" }, - "version": "5.7~ynh1", + "version": "5.7~ynh2", "url": "https://languagetool.org", + "upstream": { + "license": "LGPL-2.1-only", + "website": "https://languagetool.org", + "demo": "https://api.languagetool.org/", + "admindoc": "https://dev.languagetool.org/", + "code": "https://github.com/languagetool-org/languagetool" + }, "license": "LGPL-2.1-only", "maintainer": { "name": "Jules Bertholet", "email": "jules.bertholet@gmail.com" }, "requirements": { - "yunohost": ">= 4.1.3" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ @@ -24,8 +31,7 @@ "install": [ { "name": "domain", - "type": "domain", - "example": "example.com" + "type": "domain" }, { "name": "use_ngram", @@ -122,4 +128,4 @@ } ] } -} \ No newline at end of file +} diff --git a/scripts/backup b/scripts/backup index 579b668..ec09318 100755 --- a/scripts/backup +++ b/scripts/backup @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup() { +ynh_clean_setup () { true } # Exit if an error occurs during the execution of the script @@ -28,8 +28,8 @@ ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) -data_path=$(ynh_app_setting_get --app=$app --key=data_path) domain=$(ynh_app_setting_get --app=$app --key=domain) +data_path=$(ynh_app_setting_get --app=$app --key=data_path) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -42,6 +42,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP THE APP DATA DIR +#================================================= + +ynh_backup --src_path="$data_path" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= @@ -63,13 +69,7 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= -# BACKUP THE APP DATA DIR -#================================================= - -ynh_backup --src_path="$data_path" --is_big - -#================================================= -# BACKUP LOG FILES +# BACKUP VARIOUS FILES #================================================= ynh_backup --src_path="/var/log/$app" diff --git a/scripts/change_url b/scripts/change_url index 1ca03be..0b1a438 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,13 +29,14 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 load_installation_settings #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade -ynh_clean_setup() { +ynh_clean_setup () { + ynh_clean_check_starting # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" @@ -50,10 +51,16 @@ ynh_abort_if_errors #================================================= change_domain=0 -if [ "$old_domain" != "$new_domain" ]; then +if [ "$old_domain" != "$new_domain" ] +then change_domain=1 fi + change_path=0 +if [ "$old_path" != "$new_path" ] +then + change_path=1 +fi #================================================= # STANDARD MODIFICATIONS @@ -71,8 +78,21 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +# Change the path in the NGINX config file +if [ $change_path -eq 1 ] +then + # Make a backup of the original NGINX config file if modified + ynh_backup_if_checksum_is_different --file="$nginx_conf_path" + # Set global variables for NGINX helper + domain="$old_domain" + path_url="$new_path" + # Create a dedicated NGINX config + ynh_add_nginx_config +fi + # Change the domain for NGINX -if [ $change_domain -eq 1 ]; then +if [ $change_domain -eq 1 ] +then # Delete file checksum for the old conf file location ynh_delete_file_checksum --file="$nginx_conf_path" mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf diff --git a/scripts/install b/scripts/install index 2bb3d0b..e6e95d5 100755 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - true + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -25,7 +25,6 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url='/' -is_public=1 use_ngram=$YNH_APP_ARG_USE_NGRAM use_untested_ngram=$YNH_APP_ARG_USE_UNTESTED_NGRAM use_word2vec=$YNH_APP_ARG_USE_WORD2VEC @@ -33,6 +32,7 @@ use_fasttext=$YNH_APP_ARG_USE_FASTTEXT use_compressed_fasttext=$YNH_APP_ARG_USE_COMPRESSED_FASTTEXT use_beolingus=$YNH_APP_ARG_USE_BEOLINGUS grammalecte_server=$YNH_APP_ARG_GRAMMALECTE_SERVER + app=$YNH_APP_INSTANCE_NAME #================================================= @@ -81,6 +81,14 @@ ynh_script_progression --message="Installing dependencies..." --weight=1 ynh_install_app_dependencies $pkg_dependencies +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=1 + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -102,12 +110,19 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 ynh_add_nginx_config #================================================= -# CREATE DEDICATED USER +# SPECIFIC SETUP #================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." -# Create a system user -ynh_system_user_create --username=$app +add_languagetool_config + +#================================================= +# COMPILE FASTTEXT +#================================================= + +compile_fasttext #================================================= # SETUP SYSTEMD @@ -117,22 +132,6 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# ADD A CONFIGURATION -#================================================= - -add_languagetool_config - -#================================================= -# SPECIFIC SETUP -#================================================= -# COMPILE FASTTEXT -#================================================= - -compile_fasttext - -#================================================= -# GENERIC FINALIZATION #================================================= # SECURE FILES AND DIRECTORIES #================================================= @@ -143,6 +142,8 @@ chmod -R g=u,g-w,o-rwx $final_path chown -R root:$app $data_path chmod -R g=u,g-w,o-rwx $data_path +#================================================= +# GENERIC FINALIZATION #================================================= # SETUP LOGROTATE #================================================= @@ -171,13 +172,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= ynh_script_progression --message="Configuring permissions..." --weight=1 -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. - ynh_permission_update --permission="main" --add="visitors" -fi +# Everyone can access the app. +# The "main" permission is automatically created before the install script. +ynh_permission_update --permission="main" --add="visitors" #================================================= # RELOAD NGINX diff --git a/scripts/remove b/scripts/remove index 5f15d06..5174c14 100755 --- a/scripts/remove +++ b/scripts/remove @@ -14,6 +14,8 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Loading installation settings..." --weight=1 +app=$YNH_APP_INSTANCE_NAME + load_installation_settings #================================================= @@ -23,7 +25,8 @@ load_installation_settings #================================================= # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null; then +if ynh_exec_warn_less yunohost service status $app >/dev/null +then ynh_script_progression --message="Removing $app service integration..." --weight=1 yunohost service remove $app fi @@ -37,12 +40,12 @@ ynh_script_progression --message="Stopping and removing the systemd service..." ynh_remove_systemd_config #================================================= -# REMOVE DEPENDENCIES +# REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 -# Remove metapackage and its dependencies -ynh_remove_app_dependencies +# Remove the app-specific logrotate config +ynh_remove_logrotate #================================================= # REMOVE APP MAIN DIR @@ -69,12 +72,12 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- ynh_remove_nginx_config #================================================= -# REMOVE LOGROTATE CONFIGURATION +# REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 +ynh_script_progression --message="Removing dependencies..." --weight=1 -# Remove the app-specific logrotate config -ynh_remove_logrotate +# Remove metapackage and its dependencies +ynh_remove_app_dependencies #================================================= # SPECIFIC REMOVE diff --git a/scripts/restore b/scripts/restore index b0f44de..c4d3ec9 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,8 +14,8 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup() { - true +ynh_clean_setup () { + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -25,6 +25,8 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Loading installation settings..." --weight=1 +app=$YNH_APP_INSTANCE_NAME + load_installation_settings #================================================= @@ -32,20 +34,22 @@ load_installation_settings #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -ynh_webpath_available --domain=$domain --path_url=$path_url || - ynh_die --message="Path not available: ${domain}${path_url}" -test ! -d $final_path || - ynh_die --message="There is already a directory: $final_path " -test ! -d $data_path || - ynh_die --message="There is already a directory: $data_path " +ynh_webpath_available --domain=$domain --path_url=$path_url \ + || ynh_die --message="Path not available: ${domain}${path_url}" +test ! -d $final_path \ + || ynh_die --message="There is already a directory: $final_path " +test ! -d $data_path \ + || ynh_die --message="There is already a directory: $data_path " #================================================= # STANDARD RESTORATION STEPS #================================================= -# RESTORE THE NGINX CONFIGURATION +# RECREATE THE DEDICATED USER #================================================= +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE THE APP MAIN DIR @@ -65,14 +69,6 @@ if [ ! -d "$data_path" ]; then add_languagetool_config fi -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # RESTORE USER RIGHTS #================================================= @@ -90,6 +86,20 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + +#================================================= +# RESTORE VARIOUS FILES +#================================================= +ynh_script_progression --message="Restoring various files..." + +ynh_restore_file --origin_path="/var/log/$app" + #================================================= # RESTORE SYSTEMD #================================================= @@ -98,6 +108,13 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= @@ -105,12 +122,6 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Multilingual grammar, style, and spell checker" --log="/var/log/$app/$app.log" -#================================================= -# RESTORE LOG FILES -#================================================= - -ynh_restore_file --origin_path="/var/log/$app" - #================================================= # START SYSTEMD SERVICE #================================================= @@ -118,12 +129,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2caad71..7e2fb30 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -14,19 +14,14 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Loading installation settings..." --weight=1 -load_installation_settings +app=$YNH_APP_INSTANCE_NAME -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -if [ -z "$use_beolingus" ]; then - use_beolingus=0 - ynh_app_setting_set --app=$app --key=use_beolingus --value=$use_beolingus -fi +load_installation_settings #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) @@ -37,7 +32,8 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade -ynh_clean_setup() { +ynh_clean_setup () { + ynh_clean_check_starting # Restore it if the upgrade fails ynh_restore_upgradebackup } @@ -53,11 +49,30 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." + +if [ -z "$use_beolingus" ]; then + use_beolingus=0 + ynh_app_setting_set --app=$app --key=use_beolingus --value=$use_beolingus +fi + +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ]; then +if [ "$upgrade_type" == "UPGRADE_APP" ] +then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src @@ -66,6 +81,13 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]; then download_data fi +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=1 + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # NGINX CONFIGURATION #================================================= @@ -74,21 +96,6 @@ 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 -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # SPECIFIC UPGRADE #================================================= @@ -97,6 +104,20 @@ ynh_system_user_create --username=$app compile_fasttext +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." + +add_languagetool_config + +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions on app files +set_permissions + #================================================= # SETUP SYSTEMD #================================================= @@ -105,21 +126,8 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# UPDATE A CONFIG FILE -#================================================= - -add_languagetool_config - #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -set_permissions - #================================================= # SETUP LOGROTATE #================================================= diff --git a/sources/extra_files/app/.gitignore b/sources/extra_files/app/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/sources/extra_files/app/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op] diff --git a/sources/patches/.gitignore b/sources/patches/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/sources/patches/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op]