diff --git a/ALL_README.md b/ALL_README.md index 152f2e7..e3c80d2 100644 --- a/ALL_README.md +++ b/ALL_README.md @@ -5,4 +5,6 @@ - [Irakurri README euskaraz](README_eu.md) - [Lire le README en français](README_fr.md) - [Le o README en galego](README_gl.md) +- [Baca README dalam bahasa bahasa Indonesia](README_id.md) +- [Прочитать README на русский](README_ru.md) - [阅读中文(简体)的 README](README_zh_Hans.md) diff --git a/README.md b/README.md index 7b28129..a979b0c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # HedgeDoc for YunoHost -[![Integration level](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![Working status](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/hedgedoc.svg)](https://ci-apps.yunohost.org/ci/apps/hedgedoc/) ![Working status](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) [![Install HedgeDoc with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) @@ -29,7 +29,7 @@ You can use it to easily collaborate on notes, graphs and even presentations in - Low system requirements -**Shipped version:** 1.9.9~ynh3 +**Shipped version:** 1.10.0~ynh1 **Demo:** diff --git a/README_es.md b/README_es.md index 5a3d137..ff871b6 100644 --- a/README_es.md +++ b/README_es.md @@ -5,7 +5,7 @@ No se debe editar a mano. # HedgeDoc para Yunohost -[![Nivel de integración](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) +[![Nivel de integración](https://dash.yunohost.org/integration/hedgedoc.svg)](https://ci-apps.yunohost.org/ci/apps/hedgedoc/) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) [![Instalar HedgeDoc con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) @@ -29,7 +29,7 @@ You can use it to easily collaborate on notes, graphs and even presentations in - Low system requirements -**Versión actual:** 1.9.9~ynh3 +**Versión actual:** 1.10.0~ynh1 **Demo:** diff --git a/README_eu.md b/README_eu.md index 589c529..489d899 100644 --- a/README_eu.md +++ b/README_eu.md @@ -5,7 +5,7 @@ EZ editatu eskuz. # HedgeDoc YunoHost-erako -[![Integrazio maila](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) +[![Integrazio maila](https://dash.yunohost.org/integration/hedgedoc.svg)](https://ci-apps.yunohost.org/ci/apps/hedgedoc/) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) [![Instalatu HedgeDoc YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) @@ -29,7 +29,7 @@ You can use it to easily collaborate on notes, graphs and even presentations in - Low system requirements -**Paketatutako bertsioa:** 1.9.9~ynh3 +**Paketatutako bertsioa:** 1.10.0~ynh1 **Demoa:** diff --git a/README_fr.md b/README_fr.md index 4dea3b7..3ed6684 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,7 +5,7 @@ Il NE doit PAS être modifié à la main. # HedgeDoc pour YunoHost -[![Niveau d’intégration](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/hedgedoc.svg)](https://ci-apps.yunohost.org/ci/apps/hedgedoc/) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) [![Installer HedgeDoc avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) @@ -29,7 +29,7 @@ Vous pouvez l'utiliser pour collaborer facilement sur des notes, des graphiques - Faible configuration système requise -**Version incluse :** 1.9.9~ynh3 +**Version incluse :** 1.10.0~ynh1 **Démo :** diff --git a/README_gl.md b/README_gl.md index 0f27824..978f0a5 100644 --- a/README_gl.md +++ b/README_gl.md @@ -5,7 +5,7 @@ NON debe editarse manualmente. # HedgeDoc para YunoHost -[![Nivel de integración](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) +[![Nivel de integración](https://dash.yunohost.org/integration/hedgedoc.svg)](https://ci-apps.yunohost.org/ci/apps/hedgedoc/) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) [![Instalar HedgeDoc con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) @@ -29,7 +29,7 @@ You can use it to easily collaborate on notes, graphs and even presentations in - Low system requirements -**Versión proporcionada:** 1.9.9~ynh3 +**Versión proporcionada:** 1.10.0~ynh1 **Demo:** diff --git a/README_id.md b/README_id.md new file mode 100644 index 0000000..6dc15c7 --- /dev/null +++ b/README_id.md @@ -0,0 +1,60 @@ + + +# HedgeDoc untuk YunoHost + +[![Tingkat integrasi](https://dash.yunohost.org/integration/hedgedoc.svg)](https://ci-apps.yunohost.org/ci/apps/hedgedoc/) ![Status kerja](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Status pemeliharaan](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) + +[![Pasang HedgeDoc dengan YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) + +*[Baca README ini dengan bahasa yang lain.](./ALL_README.md)* + +> *Paket ini memperbolehkan Anda untuk memasang HedgeDoc secara cepat dan mudah pada server YunoHost.* +> *Bila Anda tidak mempunyai YunoHost, silakan berkonsultasi dengan [panduan](https://yunohost.org/install) untuk mempelajari bagaimana untuk memasangnya.* + +## Ringkasan + +HedgeDoc (formerly known as CodiMD) is an open-source, web-based, self-hosted, collaborative markdown editor. +You can use it to easily collaborate on notes, graphs and even presentations in real-time. All you need to do is to share your note-link to your co-workers and they’re ready to go. + +### Features + +- Real-time collaboration +- Graphs & diagrams +- Revisions +- Presentation mode +- Easy to use permission system +- Low system requirements + + +**Versi terkirim:** 1.10.0~ynh1 + +**Demo:** + +## Tangkapan Layar + +![Tangkapan Layar pada HedgeDoc](./doc/screenshots/screenshot.png) + +## Dokumentasi dan sumber daya + +- Website aplikasi resmi: +- Dokumentasi admin resmi: +- Depot kode aplikasi hulu: +- Gudang YunoHost: +- Laporkan bug: + +## Info developer + +Silakan kirim pull request ke [`testing` branch](https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing). + +Untuk mencoba branch `testing`, silakan dilanjutkan seperti: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +atau +sudo yunohost app upgrade hedgedoc -u https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +``` + +**Info lebih lanjut mengenai pemaketan aplikasi:** diff --git a/README_ru.md b/README_ru.md new file mode 100644 index 0000000..3ea94af --- /dev/null +++ b/README_ru.md @@ -0,0 +1,60 @@ + + +# HedgeDoc для YunoHost + +[![Уровень интеграции](https://dash.yunohost.org/integration/hedgedoc.svg)](https://ci-apps.yunohost.org/ci/apps/hedgedoc/) ![Состояние работы](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Состояние сопровождения](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) + +[![Установите HedgeDoc с YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) + +*[Прочтите этот README на других языках.](./ALL_README.md)* + +> *Этот пакет позволяет Вам установить HedgeDoc быстро и просто на YunoHost-сервер.* +> *Если у Вас нет YunoHost, пожалуйста, посмотрите [инструкцию](https://yunohost.org/install), чтобы узнать, как установить его.* + +## Обзор + +HedgeDoc (formerly known as CodiMD) is an open-source, web-based, self-hosted, collaborative markdown editor. +You can use it to easily collaborate on notes, graphs and even presentations in real-time. All you need to do is to share your note-link to your co-workers and they’re ready to go. + +### Features + +- Real-time collaboration +- Graphs & diagrams +- Revisions +- Presentation mode +- Easy to use permission system +- Low system requirements + + +**Поставляемая версия:** 1.10.0~ynh1 + +**Демо-версия:** + +## Снимки экрана + +![Снимок экрана HedgeDoc](./doc/screenshots/screenshot.png) + +## Документация и ресурсы + +- Официальный веб-сайт приложения: +- Официальная документация администратора: +- Репозиторий кода главной ветки приложения: +- Магазин YunoHost: +- Сообщите об ошибке: + +## Информация для разработчиков + +Пришлите Ваш запрос на слияние в [ветку `testing`](https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing). + +Чтобы попробовать ветку `testing`, пожалуйста, сделайте что-то вроде этого: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +или +sudo yunohost app upgrade hedgedoc -u https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +``` + +**Больше информации о пакетировании приложений:** diff --git a/README_zh_Hans.md b/README_zh_Hans.md index 8b2602e..b68467d 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -5,7 +5,7 @@ # YunoHost 上的 HedgeDoc -[![集成程度](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![工作状态](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) +[![集成程度](https://dash.yunohost.org/integration/hedgedoc.svg)](https://ci-apps.yunohost.org/ci/apps/hedgedoc/) ![工作状态](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) [![使用 YunoHost 安装 HedgeDoc](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) @@ -29,7 +29,7 @@ You can use it to easily collaborate on notes, graphs and even presentations in - Low system requirements -**分发版本:** 1.9.9~ynh3 +**分发版本:** 1.10.0~ynh1 **演示:** diff --git a/conf/systemd.service b/conf/systemd.service index 017e1d6..6f38565 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,9 +8,9 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__ -Environment="__YNH_NODE_LOAD_PATH__" +Environment="PATH=__PATH_WITH_NODEJS__" Environment="NODE_ENV=production" -ExecStart=__YNH_NPM__ start --production +ExecStart=__NODEJS_DIR__/npm start --production Restart=always # Sandboxing options to harden security diff --git a/manifest.toml b/manifest.toml index f1a94c0..3d68d44 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "HedgeDoc" description.en = "Collaborative editor to work on notes written in Markdown" description.fr = "Éditeur collaboratif pour travailler sur des notes en Markdown" -version = "1.9.9~ynh3" +version = "1.10.0~ynh1" maintainers = [] @@ -17,7 +17,8 @@ admindoc = "https://docs.hedgedoc.org/" code = "https://github.com/hedgedoc/hedgedoc" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.29" +helpers_version = "2.1" architectures = "all" multi_instance = true @@ -48,8 +49,8 @@ ram.runtime = "50M" [resources.sources] [resources.sources.main] - url = "https://github.com/hedgedoc/hedgedoc/releases/download/1.9.9/hedgedoc-1.9.9.tar.gz" - sha256 = "1769d30e60458040475a6d74f53952101962c40c390765e19e6ff6f3fe70c008" + url = "https://github.com/hedgedoc/hedgedoc/releases/download/1.10.0/hedgedoc-1.10.0.tar.gz" + sha256 = "c0024ff8b7d5483d5115af3a8981ad8a2c6237fc2d63893219f1e6ce3079938e" autoupdate.strategy = "latest_github_tag" [resources.ports] diff --git a/scripts/_common.sh b/scripts/_common.sh index 44277c5..cd2354e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,19 +1,7 @@ #!/bin/bash #================================================= -# COMMON VARIABLES +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= nodejs_version=20 - -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS -#================================================= diff --git a/scripts/backup b/scripts/backup index c711f03..587b47d 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,42 +1,33 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_backup --src_path="/etc/systemd/system/$app.service" +ynh_backup "/etc/systemd/system/$app.service" #================================================= # BACKUP THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Backing up the PostgreSQL database..." +ynh_print_info "Backing up the PostgreSQL database..." -ynh_psql_dump_db --database="$db_name" > db.sql +ynh_psql_dump_db > db.sql #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "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 85e7e6c..f96a068 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,29 +1,21 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name=$app --action=stop --log_path=systemd +ynh_systemctl --service=$app --action=stop --log_path=systemd #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # SPECIFIC MODIFICATIONS @@ -31,28 +23,26 @@ ynh_change_url_nginx_config # CONFIGURE HEDGEDOC #================================================= -ynh_backup_if_checksum_is_different --file="$install_dir/config.json" +ynh_backup_if_checksum_is_different "$install_dir/config.json" domain=$new_domain url_path=${new_path#/} -ynh_add_config --template="../conf/config.json.example" --destination="$install_dir/config.json" +ynh_config_add --template="config.json.example" --destination="$install_dir/config.json" -chmod 400 "$install_dir/config.json" -chown $app:$app "$install_dir/config.json" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config.json" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config.json" -#================================================= -# GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening" +ynh_systemctl --service=$app --action=start --log_path=systemd --wait_until="HTTP Server listening" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 934f387..f383f9f 100644 --- a/scripts/install +++ b/scripts/install @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -23,39 +17,34 @@ require_free_url_authentication=false # STORE SETTINGS FROM MANIFEST #================================================= -ynh_app_setting_set --app=$app --key=allow_anonymous --value=$allow_anonymous -ynh_app_setting_set --app=$app --key=allow_email_registration --value=$allow_email_registration -ynh_app_setting_set --app=$app --key=allow_free_url --value=$allow_free_url -ynh_app_setting_set --app=$app --key=require_free_url_authentication --value=$require_free_url_authentication -ynh_app_setting_set --app=$app --key=allow_anonymous_edits --value=$allow_anonymous_edits +ynh_app_setting_set --key=allow_anonymous --value=$allow_anonymous +ynh_app_setting_set --key=allow_email_registration --value=$allow_email_registration +ynh_app_setting_set --key=allow_free_url --value=$allow_free_url +ynh_app_setting_set --key=require_free_url_authentication --value=$require_free_url_authentication +ynh_app_setting_set --key=allow_anonymous_edits --value=$allow_anonymous_edits #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=20 +ynh_script_progression "Installing dependencies..." -# Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +ynh_nodejs_install #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=2 +ynh_script_progression "Setting up source files..." -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$install_dir -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 +ynh_script_progression "Adding system configurations related to $app..." -ynh_add_nginx_config +ynh_config_add_nginx -ynh_add_systemd_config +ynh_config_add_systemd yunohost service add $app --description="Collaborative Markdown editor" --log="/var/log/$app/$app.log" @@ -64,35 +53,31 @@ yunohost service add $app --description="Collaborative Markdown editor" --log="/ #============================================== # INSTALL HEDGEDOC #============================================== -ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=10 +ynh_script_progression "Building $app... (this will take some time and resources!)" pushd "$install_dir" - ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn workspaces focus --production - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean + + ynh_hide_warnings ynh_exec_as_app yarn workspaces focus --production + ynh_hide_warnings ynh_exec_as_app yarn cache clean popd #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_script_progression --message="Modifying a config file..." --weight=1 +ynh_script_progression "Updating configuration..." url_path=${path#/} -ynh_add_config --template="config.json.example" --destination="$install_dir/config.json" - -chmod 600 "$install_dir/config.json" -chown $app:$app "$install_dir/config.json" +ynh_config_add --template="config.json.example" --destination="$install_dir/config.json" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=2 +ynh_script_progression "Starting $app's systemd service..." -# Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening" +ynh_systemctl --service=$app --action=start --log_path=systemd --wait_until="HTTP Server listening" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 159acb6..846b474 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,36 +1,27 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 +ynh_script_progression "Removing system configurations related to $app..." -# 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 +if ynh_hide_warnings yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service..." --weight=1 + ynh_script_progression "Removing $app service..." yunohost service remove $app fi -ynh_remove_systemd_config +ynh_config_remove_systemd -ynh_remove_nodejs +ynh_nodejs_remove -ynh_remove_nginx_config +ynh_config_remove_nginx #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index f41173e..e025ff6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,49 +1,38 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring HedgeDoc main directory..." --weight=10 +ynh_script_progression "Restoring HedgeDoc main directory..." -ynh_restore_file --origin_path="$install_dir" +ynh_restore "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - -#================================================= -# SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=6 +ynh_script_progression "Reinstalling dependencies..." # Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +ynh_nodejs_install #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6 +ynh_script_progression "Restoring the PostgreSQL database..." -ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name +ynh_psql_db_shell < "./db.sql" #================================================= # RESTORE SYSTEMD #================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 +ynh_script_progression "Restoring system configurations related to $app..." -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +ynh_restore "/etc/systemd/system/$app.service" systemctl enable $app.service --quiet yunohost service add $app --description="Collaborative Markdown editor" --log="/var/log/$app/$app.log" @@ -51,14 +40,14 @@ yunohost service add $app --description="Collaborative Markdown editor" --log="/ #================================================= # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 +ynh_script_progression "Reloading NGINX web server and $app's service..." -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening" +ynh_systemctl --service=$app --action=start --log_path=systemd --wait_until="HTTP Server listening" -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 275c1d4..fc2fadd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,109 +1,78 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +ynh_script_progression "Ensuring downward compatibility..." -if [ -z "${allow_anonymous:-}" ]; then - allow_anonymous="false" - ynh_app_setting_set --app=$app --key=allow_anonymous --value=$allow_anonymous -fi +ynh_app_setting_set_default --key=allow_anonymous --value="false" -if [ -z "${allow_anonymous_edits:-}" ]; then - allow_anonymous_edits="false" - ynh_app_setting_set --app=$app --key=allow_anonymous_edits --value=$allow_anonymous_edits -fi +ynh_app_setting_set_default --key=allow_anonymous_edits --value="false" -if [ -z "${allow_email_registration:-}" ]; then - allow_email_registration="false" - ynh_app_setting_set --app=$app --key=allow_email_registration --value=$allow_email_registration -fi +ynh_app_setting_set_default --key=allow_email_registration --value="false" -if [ -z "${allow_free_url:-}" ]; then - allow_free_url="false" - ynh_app_setting_set --app=$app --key=allow_free_url --value=$allow_free_url -fi +ynh_app_setting_set_default --key=allow_free_url --value="false" -if [ -z "${require_free_url_authentication:-}" ]; then - require_free_url_authentication="false" - ynh_app_setting_set --app=$app --key=require_free_url_authentication --value=$require_free_url_authentication -fi +ynh_app_setting_set_default --key=require_free_url_authentication --value="false" -#================================================= -# STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name=$app --action=stop --log_path=systemd +ynh_systemctl --service=$app --action=stop --log_path=systemd #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Upgrading source files..." --weight=10 +ynh_script_progression "Upgrading source files..." -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$install_dir --keep="config.json" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 +ynh_script_progression "Upgrading system configurations related to $app..." -ynh_add_nginx_config +ynh_config_add_nginx -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +ynh_nodejs_install -ynh_add_systemd_config +ynh_config_add_systemd yunohost service add $app --description="Collaborative Markdown editor" --log="/var/log/$app/$app.log" #============================================== # INSTALL HEDGEDOC #============================================== -ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=10 +ynh_script_progression "Building $app... (this will take some time and resources!)" pushd "$install_dir" - ynh_secure_remove /usr/local/share/.cache/yarn - ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn workspaces focus --production - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean + ynh_safe_rm /usr/local/share/.cache/yarn + ynh_hide_warnings ynh_exec_as_app yarn workspaces focus --production + ynh_hide_warnings ynh_exec_as_app yarn cache clean popd #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_script_progression --message="Modifying a config file..." --weight=1 +ynh_script_progression "Updating configuration..." url_path=${path#/} -ynh_add_config --template="config.json.example" --destination="$install_dir/config.json" - -chmod 600 "$install_dir/config.json" -chown $app:$app "$install_dir/config.json" +ynh_config_add --template="config.json.example" --destination="$install_dir/config.json" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening" +ynh_systemctl --service=$app --action=start --log_path=systemd --wait_until="HTTP Server listening" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"