From 85b6ea1af44b5e879c0288452b2e719df22e2127 Mon Sep 17 00:00:00 2001 From: MathieuW Date: Sun, 13 Aug 2023 12:37:17 +0200 Subject: [PATCH 01/13] Create config --- scripts/config | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/config diff --git a/scripts/config b/scripts/config new file mode 100644 index 0000000..9314672 --- /dev/null +++ b/scripts/config @@ -0,0 +1,15 @@ +#!/bin/bash +source /usr/share/yunohost/helpers +ynh_abort_if_errors + +function run__upload_button() { + local data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) + local filename="$(echo "$upload_url" | awk -F/ '{print $NF}')" + ynh_print_info --message="Downloading file…" + wget --tries 3 --no-dns-cache --timeout 900 --output-document="$data_dir/$filename" "$upload_url" 2>> + ynh_print_info --message="Adding file to Kiwix library" + $install_dir/kiwix-manage $data_dir/library.xml add "$data_dir/$filename" + yunohost service restart kiwix +} + +ynh_app_config_run $1 From 652460c6f99d4b2e4eee9011013ef977b399520d Mon Sep 17 00:00:00 2001 From: MathieuW Date: Sun, 13 Aug 2023 12:41:37 +0200 Subject: [PATCH 02/13] Create config_panel.toml --- config_panel.toml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 config_panel.toml diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..d8f6d80 --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,18 @@ +version = "1.0" + +[main] +name.en = "Upload content" + + [main.upload] + + [main.upload.upload_url] + default = "" + type = "string" + ask.en = "Content URL" + help.en = "For example: https://download.kiwix.org/zim/other/pokepedia_fr_all_maxi_2021-01.zim" + + [main.upload.upload_button] + ask.en = "Upload" + type = "button" + style = "success" + enabled = "upload_url" From 86087ad0ec1547d29d9cc7bb5f2cba58bfbf9cc8 Mon Sep 17 00:00:00 2001 From: MathieuW Date: Sun, 13 Aug 2023 12:49:32 +0200 Subject: [PATCH 03/13] Update ADMIN.md --- doc/ADMIN.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index ef264bb..e5c678e 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,5 +1,9 @@ ### How to add zim files? +#### Add a zin file through its URL +- Click on the "Upload content" tab above. + +#### Add a zim file by hand - Download one or more ZIM files, e.g. from [https://download.kiwix.org/zim/](https://download.kiwix.org/zim/) - Put the ZIM files into `__DATA_DIR__` - Add them to the library with the following command: From c8089e49012c6efc5df4d6c2a2787e1d23945249 Mon Sep 17 00:00:00 2001 From: MathieuW Date: Sun, 13 Aug 2023 12:51:43 +0200 Subject: [PATCH 04/13] Update ADMIN_fr.md --- doc/ADMIN_fr.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index 79f4ef7..883280d 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,5 +1,10 @@ ### Comment ajouter des fichiers ZIM ? + +#### Ajouter un fichier ZIM via son URL +- Sélectionnez l'onglet "Upload content" qui se trouve ci-dessus. + +#### Ajouter un fichier ZIM à la main - Téléchargez un ou plusieurs fichiers ZIM, par ex. [https://download.kiwix.org/zim/](https://download.kiwix.org/zim/) - Mettez les fichiers ZIM dans `__DATA_DIR__/` - Ajoutez-les à la bibliothèque avec la commande suivante : From c92ce9e4071067b19321a481420550eca85b1425 Mon Sep 17 00:00:00 2001 From: MathieuW Date: Sun, 13 Aug 2023 13:18:03 +0200 Subject: [PATCH 05/13] Bumped version --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 8ebfde3..7f0a509 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Kiwix" description.en = "Sharing Web content with people without Internet access" description.fr = "Partager du contenu Web avec des personnes sans accès à Internet" -version = "3.5.0~ynh3" +version = "3.5.0~ynh4" maintainers = ["eric_G"] From f8038b15401efac0773c9a37bd53af29d376019e Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 13 Aug 2023 13:30:54 +0200 Subject: [PATCH 06/13] systemd: Fix daemonize option which leaves the service as "exited" --- conf/systemd.service | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 9ee4928..c5ca7f5 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -5,8 +5,7 @@ Description=Kiwix: Sharing Web content Type=simple User=__APP__ Group=__APP__ -ExecStart=__INSTALL_DIR__/kiwix-serve --daemon --address 127.0.0.1 --port __PORT__ --library __DATA_DIR__/library.xml --urlRootLocation=__PATH__/ -RemainAfterExit=yes +ExecStart=__INSTALL_DIR__/kiwix-serve --address 127.0.0.1 --port __PORT__ --library __DATA_DIR__/library.xml --urlRootLocation=__PATH__/ Restart=on-abort RestartSec=5s From c6f012808495c6311caf8c53914e9b4e805b9f2f Mon Sep 17 00:00:00 2001 From: MathieuW Date: Sun, 13 Aug 2023 13:42:12 +0200 Subject: [PATCH 07/13] Update config --- scripts/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/config b/scripts/config index 9314672..26a4c5e 100644 --- a/scripts/config +++ b/scripts/config @@ -6,7 +6,7 @@ function run__upload_button() { local data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) local filename="$(echo "$upload_url" | awk -F/ '{print $NF}')" ynh_print_info --message="Downloading file…" - wget --tries 3 --no-dns-cache --timeout 900 --output-document="$data_dir/$filename" "$upload_url" 2>> + wget --tries 3 --no-dns-cache --timeout 900 --output-document="$data_dir/$filename" "$upload_url" 2>&1 ynh_print_info --message="Adding file to Kiwix library" $install_dir/kiwix-manage $data_dir/library.xml add "$data_dir/$filename" yunohost service restart kiwix From ff2cb523d95f311cad8c2d1464f1505e06f53abb Mon Sep 17 00:00:00 2001 From: MathieuW Date: Sun, 13 Aug 2023 13:48:48 +0200 Subject: [PATCH 08/13] Update config_panel.toml Co-authored-by: Alexandre Aubin --- config_panel.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/config_panel.toml b/config_panel.toml index d8f6d80..4c0090e 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -10,6 +10,7 @@ name.en = "Upload content" type = "string" ask.en = "Content URL" help.en = "For example: https://download.kiwix.org/zim/other/pokepedia_fr_all_maxi_2021-01.zim" + help.fr = "Par exemple: https://download.kiwix.org/zim/other/pokepedia_fr_all_maxi_2021-01.zim" [main.upload.upload_button] ask.en = "Upload" From fb8aca9878197a7f52867f0edee48c309a037ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 13 Aug 2023 14:15:54 +0200 Subject: [PATCH 09/13] Update config_panel.toml --- config_panel.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_panel.toml b/config_panel.toml index 4c0090e..3226aa9 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -10,7 +10,7 @@ name.en = "Upload content" type = "string" ask.en = "Content URL" help.en = "For example: https://download.kiwix.org/zim/other/pokepedia_fr_all_maxi_2021-01.zim" - help.fr = "Par exemple: https://download.kiwix.org/zim/other/pokepedia_fr_all_maxi_2021-01.zim" + help.fr = "Par exemple : https://download.kiwix.org/zim/other/pokepedia_fr_all_maxi_2021-01.zim" [main.upload.upload_button] ask.en = "Upload" From fac21c5c2066b8998eb36c4a92d940ca8142da6b Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 13 Aug 2023 12:24:53 +0000 Subject: [PATCH 10/13] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ad1864e..a57fe37 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Kiwix is an offline reader for online content like Wikipedia, Project Gutenberg, - Able to deal with one ZIM file or XML library files -**Shipped version:** 3.5.0~ynh3 +**Shipped version:** 3.5.0~ynh4 **Demo:** http://library.kiwix.org/ diff --git a/README_fr.md b/README_fr.md index 2c02e16..3061e17 100644 --- a/README_fr.md +++ b/README_fr.md @@ -26,7 +26,7 @@ Kiwix est un lecteur hors-ligne pour contenus web qui permet en particulier d’ - Embedded in Kiwix UI - Capable de traiter un fichier ZIM ou des fichiers de bibliothèque XML -**Version incluse :** 3.5.0~ynh3 +**Version incluse :** 3.5.0~ynh4 **Démo :** http://library.kiwix.org/ From 8c38c7bcb1b477d4527a2b8924b22f4c7956be2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 13 Aug 2023 14:32:40 +0200 Subject: [PATCH 11/13] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 7f0a509..3b68aa7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -23,7 +23,7 @@ multi_instance = true ldap = false sso = false disk = "50M" -ram.build = "50M" +ram.build = "100M" ram.runtime = "50M" [install] From a16cfdeaaabd56f3e2ebf9db93b84fb6836d9cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 13 Aug 2023 14:32:59 +0200 Subject: [PATCH 12/13] Update manifest.toml --- manifest.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 3b68aa7..7386b5f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -29,7 +29,6 @@ ram.runtime = "50M" [install] [install.domain] type = "domain" - full_domain = true [install.init_main_permission] type = "group" From 37d3a44cec30e1229f6e823f7da7ddc832af803d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 13 Aug 2023 14:40:03 +0200 Subject: [PATCH 13/13] Cleaning --- doc/ADMIN_fr.md | 1 - scripts/install | 27 ++++++++------------------- scripts/remove | 15 +++------------ scripts/restore | 26 +++++--------------------- scripts/upgrade | 20 +++----------------- 5 files changed, 19 insertions(+), 70 deletions(-) diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index 883280d..013312f 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,6 +1,5 @@ ### Comment ajouter des fichiers ZIM ? - #### Ajouter un fichier ZIM via son URL - Sélectionnez l'onglet "Upload content" qui se trouve ci-dessus. diff --git a/scripts/install b/scripts/install index e73a20e..059d53b 100755 --- a/scripts/install +++ b/scripts/install @@ -23,13 +23,18 @@ chown -R $app:www-data "$install_dir" chmod +x $install_dir/{kiwix-manage,kiwix-serve,kiwix-search} #================================================= -# NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config +# Create a dedicated systemd config +ynh_add_systemd_config + +yunohost service add $app --description="Internet without Internet access" --log="systemd" + #================================================= # CREATE DATA DIRECTORY #================================================= @@ -38,25 +43,9 @@ ynh_script_progression --message="Creating a data directory..." --weight=1 pushd $data_dir ynh_exec_warn_less ynh_exec_as $app curl -LO https://download.kiwix.org/zim/wikipedia/wikipedia_fr_climate_change_mini_2023-04.zim > /dev/null popd + ynh_exec_warn_less ynh_exec_as $app $install_dir/kiwix-manage $data_dir/library.xml add $data_dir/*.zim -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=2 - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --log="systemd" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index 06fb827..4c29204 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,10 +10,11 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE +# REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEMD SERVICE #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # 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 @@ -22,19 +23,9 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index 7f62f91..5af63ad 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,15 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -26,8 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= @@ -40,21 +29,16 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory chown -R $app:www-data "$data_dir" #================================================= -# SPECIFIC RESTORATION +# RESTORE SYSTEM CONFIGURATIONS #================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --log="systemd" +yunohost service add $app --description="Internet without Internet access" --log="systemd" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 2c79b2f..1126b63 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,35 +37,21 @@ then ynh_setup_source --dest_dir="$install_dir" fi -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" chmod +x $install_dir/{kiwix-manage,kiwix-serve,kiwix-search} #================================================= -# NGINX CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=3 - # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 - -yunohost service add $app --log="systemd" +yunohost service add $app --description="Internet without Internet access" --log="systemd" #================================================= # START SYSTEMD SERVICE