diff --git a/README.md b/README.md index fbac6bb..956aab3 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Create and edit documents collaboratively -**Shipped version:** 6.4.0~ynh2 +**Shipped version:** 7.1.0~ynh1 **Demo:** https://www.onlyoffice.com/fr/download-desktop.aspx diff --git a/README_fr.md b/README_fr.md index 2fddf3d..e66234a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Créez et éditer des documents collaborativement -**Version incluse :** 6.4.0~ynh2 +**Version incluse :** 7.1.0~ynh1 **Démo :** https://www.onlyoffice.com/fr/download-desktop.aspx diff --git a/manifest.json b/manifest.json index 9696c87..e9e2c88 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Create and edit documents collaboratively", "fr": "Créez et éditer des documents collaborativement" }, - "version": "6.4.0~ynh2", + "version": "7.1.0~ynh1", "url": "https://www.onlyoffice.com", "upstream": { "license": "GPL-3.0-or-later", @@ -20,7 +20,7 @@ "email": "liberodark@gmail.com" }, "requirements": { - "yunohost": ">= 4.2.0" + "yunohost": ">= 4.3.0" }, "multi_instance": false, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 58ae541..be1de98 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,6 +6,7 @@ # dependencies used by the app pkg_dependencies="postgresql postgresql-contrib libstdc++6 rabbitmq-server libcurl4-dev" +extra_dependencies="onlyoffice-documentserver ttf-mscorefonts-installer" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 48daceb..aa0bf53 100644 --- a/scripts/backup +++ b/scripts/backup @@ -52,6 +52,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_backup --src_path="/etc/onlyoffice" +ynh_backup --src_path="/var/lib/onlyoffice/documentserver/App_Data/cache/files" --not_mandatory #================================================= # BACKUP THE POSTGRESQL DATABASE @@ -64,4 +65,4 @@ ynh_psql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for OnlyOffice. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index d1742a8..3371f26 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -114,4 +114,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for OnlyOffice" +ynh_script_progression --message="Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index a70a476..866c5fe 100644 --- a/scripts/install +++ b/scripts/install @@ -72,14 +72,6 @@ ynh_script_progression --message="Configuring system user..." # Create a system user ynh_system_user_create --username=$app -#================================================= -# ADD ONLYOFFICE REPOSITORY -#================================================= -ynh_script_progression --message="Add OnlyOffice repository..." - -apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5 -ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian squeeze main" --append - #================================================= # INSTALL DEPENDENCIES #================================================= @@ -96,7 +88,7 @@ db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_name --db_name=$db_name +ynh_psql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # NGINX CONFIGURATION @@ -130,11 +122,14 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set- #================================================= ynh_script_progression --message="Install OnlyOffice..." +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5 2>/dev/null + # The onlyoffice dev had the magnificent idea to add a "nginx restart" during # the install/configure of their package, which is awful since that will # restart nginx and the whole webadmin and maybe even the yunohost command # running the install ... -ynh_exec_warn_less ynh_add_app_dependencies --package="onlyoffice-documentserver" + +ynh_install_extra_app_dependencies --repo="https://download.onlyoffice.com/repo/debian squeeze main" --package=$extra_dependencies 2>/dev/null #================================================= # MODIFY A CONFIG FILE @@ -151,6 +146,17 @@ ynh_script_progression --message="Storing the config file checksum..." # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="/etc/onlyoffice/documentserver/default.json" +#================================================= +# GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions to app files +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R ds:ds "$final_path" + #================================================= # RELOAD ONLYOFFICE #================================================= @@ -167,8 +173,6 @@ ynh_script_progression --message="Generating fonts..." /usr/bin/documentserver-generate-allfonts.sh -#================================================= -# GENERIC FINALIZATION #================================================= # SETUP SSOWAT #================================================= @@ -191,4 +195,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of OnlyOffice completed" +ynh_script_progression --message="Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index bb57f83..4cced44 100644 --- a/scripts/remove +++ b/scripts/remove @@ -37,7 +37,7 @@ ynh_secure_remove --file=/var/lib/dpkg/info/onlyoffice-documentserver.prerm # already removed ... so their removal fails which breaks dpkg. # So instead, we trick it with this stupid link to /bin/true which is removed # right after. -ln -s /bin/true /usr/local/bin/supervisorctl +#ln -s /bin/true /usr/local/bin/supervisorctl ynh_package_autopurge onlyoffice-documentserver #================================================= @@ -55,11 +55,10 @@ ynh_script_progression --message="Removing dependencies..." # Remove metapackage and its dependencies ynh_remove_app_dependencies -ynh_remove_extra_repo dpkg --configure -a -apt-key del "E09C A29F 6E17 8040 EF22 B409 8320 CA65 CB2D E8E5" +apt-key del "E09C A29F 6E17 8040 EF22 B409 8320 CA65 CB2D E8E5" 2>/dev/null #================================================= # REMOVE APP MAIN DIR @@ -87,7 +86,6 @@ ynh_script_progression --message="Removing file..." # Remove a directory securely ynh_secure_remove --file="/etc/onlyoffice" ynh_secure_remove --file="/var/lib/onlyoffice" -#ynh_secure_remove --file="/var/cache/nginx/onlyoffice" # Remove the log files ynh_secure_remove --file="/var/log/$app" @@ -107,4 +105,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of OnlyOffice completed" +ynh_script_progression --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 9d78ad9..6769bc0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -58,16 +58,6 @@ ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) ynh_system_user_create --username=$app -#================================================= -# SPECIFIC RESTORATION -#================================================= -# ADD ONLYOFFICE REPOSITORY -#================================================= -ynh_script_progression --message="Add OnlyOffice repository..." - -apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5 -ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian squeeze main" --append - #================================================= # REINSTALL DEPENDENCIES #================================================= @@ -76,6 +66,8 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#================================================= +# SPECIFIC RESTORATION #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= @@ -101,7 +93,9 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set- #================================================= ynh_script_progression --message="Reinstalling OnlyOffice..." -ynh_exec_warn_less ynh_add_app_dependencies --package="onlyoffice-documentserver" +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5 + +ynh_install_extra_app_dependencies --repo="https://download.onlyoffice.com/repo/debian squeeze main" --package=$extra_dependencies #================================================= # RESTORE THE CONFIGURATION @@ -110,6 +104,11 @@ ynh_script_progression --message="Restoring the configuration..." ynh_restore_file --origin_path="/etc/onlyoffice" +#================================================= +# RESTORE THE CACHE +#================================================= +ynh_restore_file --origin_path="/var/lib/onlyoffice/documentserver/App_Data/cache/files" + #================================================= # REGENERATE FONTS #================================================= @@ -117,6 +116,17 @@ ynh_script_progression --message="Generating fonts..." /usr/bin/documentserver-generate-allfonts.sh +#================================================= +# GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions to app files +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R ds:ds "$final_path" + #================================================= # RELOAD ONLYOFFICE #================================================= @@ -139,4 +149,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for OnlyOffice" +ynh_script_progression --message="Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 819d017..c227292 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,6 +80,13 @@ ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create --username=$app +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." + +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -96,23 +103,8 @@ fi # Create a dedicated nginx config ynh_add_nginx_config "nextclouddomain" -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." - -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - #================================================= # SPECIFIC UPGRADE -#================================================= -# ADD ONLYOFFICE REPOSITORY -#================================================= -ynh_script_progression --message="Add OnlyOffice repository..." - -apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5 -ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian squeeze main" --append - #================================================= # CONFIGURE ONLYOFFICE #================================================= @@ -130,7 +122,11 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set- #================================================= ynh_script_progression --message="Upgrading OnlyOffice..." -ynh_exec_warn_less ynh_add_app_dependencies --package="onlyoffice-documentserver" +ynh_remove_extra_repo --name="$app" # backward compat +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5 + +# ynh_remove_app_dependencies +ynh_install_extra_app_dependencies --repo="https://download.onlyoffice.com/repo/debian squeeze main" --package=$extra_dependencies #================================================= # MODIFY A CONFIG FILE @@ -153,6 +149,15 @@ ynh_script_progression --message="Generating fonts..." #================================================= # GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions to app files +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R ds:ds "$final_path" + #================================================= # RELOAD ONLYOFFICE #================================================= @@ -173,4 +178,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of OnlyOffice completed" +ynh_script_progression --message="Upgrade of $app completed"