diff --git a/README.md b/README.md
index 892b4c2..4308445 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,8 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview
-The YaCy search engine software provides results from a network of independent peers, instead of a central server. It is a distributed network where no single entity decides what to list or order it appears in.
+The YaCy search engine software provides results from a network of independent peers, instead of a central server.
+It is a distributed network where no single entity decides what to list or order it appears in.
**Shipped version:** 1.924~ynh1
@@ -25,14 +26,6 @@ The YaCy search engine software provides results from a network of independent p

-## Disclaimers / important information
-
-You can reset the Yacy administration password from the commande line using:
-
-```
-sudo -u yacy YACY_DATA_PATH=/home/yunohost.app/yacy/DATA /var/www/yacy/bin/passwd.sh youpassword
-```
-
## Documentation and resources
* Official app website:
diff --git a/README_fr.md b/README_fr.md
index 623be45..1ada805 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -16,7 +16,8 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
## Vue d’ensemble
-The YaCy search engine software provides results from a network of independent peers, instead of a central server. It is a distributed network where no single entity decides what to list or order it appears in.
+The YaCy search engine software provides results from a network of independent peers, instead of a central server.
+It is a distributed network where no single entity decides what to list or order it appears in.
**Version incluse :** 1.924~ynh1
@@ -25,14 +26,6 @@ The YaCy search engine software provides results from a network of independent p

-## Avertissements / informations importantes
-
-You can reset the Yacy administration password from the commande line using:
-
-```
-sudo -u yacy YACY_DATA_PATH=/home/yunohost.app/yacy/DATA /var/www/yacy/bin/passwd.sh youpassword
-```
-
## Documentations et ressources
* Site officiel de l’app :
diff --git a/check_process b/check_process
deleted file mode 100644
index 1dbabd7..0000000
--- a/check_process
+++ /dev/null
@@ -1,22 +0,0 @@
-;; Test complet
- ; Manifest
- domain="domain.tld"
- path="/path"
- password="1Strong-Password"
- ; Checks
- pkg_linter=1
- setup_sub_dir=1
- setup_root=1
- setup_nourl=0
- setup_private=0
- setup_public=0
- upgrade=1
- # 1.0~ynh1
- upgrade=1 from_commit=ca4d54e5e6c1bc7d772e375f6193b46f886034a5
- backup_restore=1
- multi_instance=0
- port_already_use=0
- change_url=1
-;;; Options
-Email=
-Notification=none
diff --git a/conf/app.src b/conf/app.src
deleted file mode 100644
index d759bce..0000000
--- a/conf/app.src
+++ /dev/null
@@ -1,7 +0,0 @@
-SOURCE_URL=https://download.yacy.net/yacy_v1.924_20210209_10069.tar.gz
-SOURCE_SUM=18b88ed77a1dac71182fb84f2ac306c6c9d282fe074d78068f6f2bbec48d1757
-SOURCE_SUM_PRG=sha256sum
-SOURCE_FORMAT=tar.gz
-SOURCE_IN_SUBDIR=true
-SOURCE_FILENAME=
-SOURCE_EXTRACT=true
diff --git a/conf/nginx.conf b/conf/nginx.conf
index c9114db..d950efb 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -1,26 +1,26 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
- proxy_pass http://127.0.0.1:__PORT__/;
- proxy_redirect off;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- client_max_body_size 10m;
- client_body_buffer_size 128k;
- proxy_connect_timeout 3s;
- proxy_send_timeout 10s;
- proxy_read_timeout 10s;
- proxy_buffer_size 4k;
- proxy_buffers 4 32k;
- proxy_busy_buffers_size 64k;
- proxy_temp_file_write_size 64k;
+ proxy_pass http://127.0.0.1:__PORT__/;
+ proxy_redirect off;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ client_max_body_size 10m;
+ client_body_buffer_size 128k;
+ proxy_connect_timeout 3s;
+ proxy_send_timeout 10s;
+ proxy_read_timeout 10s;
+ proxy_buffer_size 4k;
+ proxy_buffers 4 32k;
+ proxy_busy_buffers_size 64k;
+ proxy_temp_file_write_size 64k;
- # Include SSOWAT user panel.
- #include conf.d/yunohost_panel.conf.inc;
+ # Include SSOWAT user panel.
+ #include conf.d/yunohost_panel.conf.inc;
}
location \.(jpg|png|gif|jpeg|css)$ {
- proxy_buffering on;
- proxy_cache_valid 200 120m;
- expires 864000;
+ proxy_buffering on;
+ proxy_cache_valid 200 120m;
+ expires 864000;
}
diff --git a/conf/systemd.service b/conf/systemd.service
index c996d31..649166b 100644
--- a/conf/systemd.service
+++ b/conf/systemd.service
@@ -6,9 +6,9 @@ After=network.target
Type=forking
User=__APP__
Group=__APP__
-WorkingDirectory=__FINALPATH__/
-ExecStart=__FINALPATH__/startYACY.sh --startup __DATADIR__/
-ExecStop=__FINALPATH__/stopYACY.sh
+WorkingDirectory=__INSTALL_DIR__/
+ExecStart=__INSTALL_DIR__/startYACY.sh --startup __DATA_DIR__/
+ExecStop=__INSTALL_DIR__/stopYACY.sh
[Install]
WantedBy=multi-user.target
diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md
similarity index 95%
rename from doc/DISCLAIMER.md
rename to doc/ADMIN.md
index f7024c9..b933722 100644
--- a/doc/DISCLAIMER.md
+++ b/doc/ADMIN.md
@@ -1,5 +1,5 @@
You can reset the Yacy administration password from the commande line using:
-```
+```bash
sudo -u yacy YACY_DATA_PATH=/home/yunohost.app/yacy/DATA /var/www/yacy/bin/passwd.sh youpassword
```
diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md
index 0930e8f..0f31497 100644
--- a/doc/DESCRIPTION.md
+++ b/doc/DESCRIPTION.md
@@ -1 +1,2 @@
-The YaCy search engine software provides results from a network of independent peers, instead of a central server. It is a distributed network where no single entity decides what to list or order it appears in.
+The YaCy search engine software provides results from a network of independent peers, instead of a central server.
+It is a distributed network where no single entity decides what to list or order it appears in.
diff --git a/manifest.json b/manifest.json
deleted file mode 100644
index 173f800..0000000
--- a/manifest.json
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "name": "YaCy",
- "id": "yacy",
- "packaging_format": 1,
- "description": {
- "en": "Free and decentralized search engine",
- "fr": "Moteur de recherche libre et décentralisé"
- },
- "version": "1.924~ynh1",
- "url": "https://yacy.net/",
- "upstream": {
- "license": "GPL-2.0-or-later",
- "website": "https://yacy.net/",
- "code": "https://github.com/yacy/yacy_search_server"
- },
- "license": "GPL-2.0-or-later",
- "maintainer": {
- "name": "Moul",
- "email": "moul@moul.re",
- "url": "yunohost.org"
- },
- "requirements": {
- "yunohost": ">= 4.3.0"
- },
- "multi_instance": false,
- "services": [
- "nginx"
- ],
- "arguments": {
- "install": [
- {
- "name": "domain",
- "type": "domain"
- },
- {
- "name": "path",
- "type": "path",
- "example": "/yacy",
- "default": "/yacy"
- },
- {
- "name": "password",
- "type": "password",
- "help": {
- "en": "Choose an administrator password.",
- "fr": "Choisissez un mot de passe d'administration."
- }
- }
- ]
- }
-}
diff --git a/manifest.toml b/manifest.toml
new file mode 100644
index 0000000..efd195e
--- /dev/null
+++ b/manifest.toml
@@ -0,0 +1,72 @@
+#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
+
+packaging_format = 2
+
+id = "yacy"
+name = "YaCy"
+description.en = "Free and decentralized search engine"
+description.fr = "Moteur de recherche libre et décentralisé"
+
+version = "1.924~ynh2"
+
+maintainers = ["Moul"]
+
+[upstream]
+license = "GPL-2.0-or-later"
+website = "https://yacy.net/"
+code = "https://github.com/yacy/yacy_search_server"
+
+[integration]
+yunohost = ">= 11.2"
+architectures = "all"
+multi_instance = false
+ldap = "not_relevant"
+sso = "not_relevant"
+disk = "150M"
+ram.build = "500M"
+ram.runtime = "590M"
+
+[install]
+ [install.domain]
+ # this is a generic question - ask strings are automatically handled by Yunohost's core
+ type = "domain"
+
+ [install.path]
+ # this is a generic question - ask strings are automatically handled by Yunohost's core
+ type = "path"
+ default = "/yacy"
+
+ [install.init_main_permission]
+ type = "group"
+ default = "visitors"
+
+ [install.password]
+ # this is a generic question - ask strings are automatically handled by Yunohost's core
+ help.en = "Choose an administrator password."
+ help.fr = "Choisissez un mot de passe d'administration."
+ type = "password"
+
+[resources]
+ [resources.sources.main]
+ url = "https://download.yacy.net/yacy_v1.924_20210209_10069.tar.gz"
+ sha256 = "18b88ed77a1dac71182fb84f2ac306c6c9d282fe074d78068f6f2bbec48d1757"
+
+ autoupdate.strategy = "latest_github_tag"
+ autoupdate.asset = "tarball"
+
+ [resources.system_user]
+
+ [resources.install_dir]
+
+ [resources.data_dir]
+
+ [resources.permissions]
+ main.url = "/"
+
+ [resources.ports]
+ main.default = 8090
+
+ [resources.apt]
+ packages = [
+ "openjdk-11-jre-headless"
+ ]
diff --git a/scripts/_common.sh b/scripts/_common.sh
index 474bc51..944a65e 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -4,9 +4,6 @@
# COMMON VARIABLES
#=================================================
-# dependencies used by the app
-pkg_dependencies="openjdk-11-jre-headless"
-
#=================================================
# PERSONAL HELPERS
#=================================================
diff --git a/scripts/backup b/scripts/backup
index d8cb0be..45a6474 100644
--- a/scripts/backup
+++ b/scripts/backup
@@ -10,27 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
- true
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_print_info --message="Loading installation settings..."
-
-app=$YNH_APP_INSTANCE_NAME
-
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-datadir=$(ynh_app_setting_get --app=$app --key=datadir)
-
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
@@ -40,13 +19,13 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
-ynh_backup --src_path="$final_path"
+ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE DATA DIR
#=================================================
-ynh_backup --src_path="$datadir" --is_big
+ynh_backup --src_path="$data_dir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION
diff --git a/scripts/change_url b/scripts/change_url
index 9cdffb2..fb2fb5e 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -9,67 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# RETRIEVE ARGUMENTS
-#=================================================
-
-old_domain=$YNH_APP_OLD_DOMAIN
-old_path=$YNH_APP_OLD_PATH
-
-new_domain=$YNH_APP_NEW_DOMAIN
-new_path=$YNH_APP_NEW_PATH
-
-app=$YNH_APP_INSTANCE_NAME
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..."
-
-# Needed for helper "ynh_add_nginx_config"
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-datadir=$(ynh_app_setting_get --app=$app --key=datadir)
-port=$(ynh_app_setting_get --app=$app --key=port)
-
-# Add settings here as needed by your application
-#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
-#db_user=$db_name
-#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
-
-#=================================================
-# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
-#=================================================
-ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
-
-# Backup the current version of the app
-ynh_backup_before_upgrade
-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"
-
- # Restore it if the upgrade fails
- ynh_restore_upgradebackup
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# CHECK WHICH PARTS SHOULD BE CHANGED
-#=================================================
-
-change_domain=0
-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
#=================================================
@@ -77,36 +16,14 @@ fi
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
-ynh_systemd_action --service_name=$app --action="stop" --log_path="$datadir/DATA/LOG/yacy00.log"
+ynh_systemd_action --service_name="$app" --action="stop" --log_path="$data_dir/DATA/LOG/yacy00.log"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
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
- # 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
- # Store file checksum for the new config file location
- ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
-fi
+ynh_change_url_nginx_config
#=================================================
# SPECIFIC MODIFICATIONS
@@ -115,7 +32,9 @@ fi
#=================================================
ynh_script_progression --message="Updating a configuration file..."
-ynh_replace_string --match_string="promoteSearchPageGreeting.homepage=https://$old_domain$old_path" --replace_string="promoteSearchPageGreeting.homepage=https://$new_domain$new_path" --target_file="$datadir/DATA/SETTINGS/yacy.conf"
+ynh_replace_string --target_file="$data_dir/DATA/SETTINGS/yacy.conf" \
+ --match_string="promoteSearchPageGreeting.homepage=https://$old_domain$old_path" \
+ --replace_string="promoteSearchPageGreeting.homepage=https://$new_domain$new_path"
#=================================================
# GENERIC FINALISATION
@@ -125,14 +44,7 @@ ynh_replace_string --match_string="promoteSearchPageGreeting.homepage=https://$o
ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
-ynh_systemd_action --service_name=$app --action="start" --log_path="$datadir/DATA/LOG/yacy00.log" --line_match="Started httpd:"
-
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..."
-
-ynh_systemd_action --service_name=nginx --action=reload
+ynh_systemd_action --service_name="$app" --action="start" --log_path="$data_dir/DATA/LOG/yacy00.log" --line_match="Started httpd:"
#=================================================
# END OF SCRIPT
diff --git a/scripts/install b/scripts/install
index 11617b0..fe77104 100644
--- a/scripts/install
+++ b/scripts/install
@@ -9,142 +9,45 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
- ynh_clean_check_starting
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# RETRIEVE ARGUMENTS FROM THE MANIFEST
-#=================================================
-
-domain=$YNH_APP_ARG_DOMAIN
-path_url=$YNH_APP_ARG_PATH
-password="$YNH_APP_ARG_PASSWORD"
-
-app=$YNH_APP_INSTANCE_NAME
-
-#=================================================
-# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
-#=================================================
-ynh_script_progression --message="Validating installation parameters..."
-
-final_path=/var/www/$app
-test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
-
-# Register (book) web path
-ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
-
-#=================================================
-# STORE SETTINGS FROM MANIFEST
-#=================================================
-ynh_script_progression --message="Storing installation settings..."
-
-ynh_app_setting_set --app=$app --key=domain --value=$domain
-ynh_app_setting_set --app=$app --key=path --value=$path_url
-
-#=================================================
-# STANDARD MODIFICATIONS
-#=================================================
-# FIND AND OPEN A PORT
-#=================================================
-ynh_script_progression --message="Finding an available port..."
-
-# Find an available port
-port=8090
-ynh_app_setting_set --app=$app --key=port --value=$port
-
-#=================================================
-# INSTALL DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Installing dependencies..."
-
-ynh_install_app_dependencies $pkg_dependencies
-
-#=================================================
-# CREATE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Configuring system user..."
-
-# Create a system user
-ynh_system_user_create --username=$app --home_dir="$final_path"
-
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
-ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
-ynh_setup_source --dest_dir="$final_path"
+ynh_setup_source --dest_dir="$install_dir"
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app:www-data "$final_path"
+chmod -R o-rwx "$install_dir"
+chown -R "$app:www-data" "$install_dir"
#=================================================
-# NGINX CONFIGURATION
+# SYSTEM CONFIGURATION
#=================================================
-ynh_script_progression --message="Configuring NGINX web server..."
+ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
-#=================================================
-# SPECIFIC SETUP
-#=================================================
-# CREATE DATA DIRECTORY
-#=================================================
-ynh_script_progression --message="Creating a data directory..."
-
-datadir=/home/yunohost.app/$app
-ynh_app_setting_set --app=$app --key=datadir --value=$datadir
-
-mkdir -p $datadir
-
-chmod 750 "$datadir"
-chmod -R o-rwx "$datadir"
-chown -R $app:www-data "$datadir"
-
-#=================================================
-# SETUP SYSTEMD
-#=================================================
-ynh_script_progression --message="Configuring a systemd service..."
-
# Create a dedicated systemd config
ynh_add_systemd_config
+yunohost service add "$app" --log="$data_dir/DATA/LOG/yacy00.log"
+#=================================================
+# APP INITIAL CONFIGURATION
#=================================================
# CONFIGURE YACY
#=================================================
ynh_script_progression --message="Configuring Yacy..."
-ynh_systemd_action --service_name=$app --action="start" --log_path="$datadir/DATA/LOG/yacy00.log" --line_match="Started httpd:"
+ynh_systemd_action --service_name="$app" --action="start" --log_path="$data_dir/DATA/LOG/yacy00.log" --line_match="Started httpd:"
-ynh_exec_as $app YACY_DATA_PATH=$datadir/DATA $final_path/bin/passwd.sh "$password"
+ynh_exec_as "$app" YACY_DATA_PATH="$data_dir/DATA" "$install_dir/bin/passwd.sh" "$password"
-ynh_systemd_action --service_name=$app --action="stop" --log_path="$datadir/DATA/LOG/yacy00.log"
+ynh_systemd_action --service_name="$app" --action="stop" --log_path="$data_dir/DATA/LOG/yacy00.log"
-#=================================================
-# ADD A CONFIGURATION
-#=================================================
-ynh_script_progression --message="Adding a configuration file..."
-
-ynh_replace_string --match_string="promoteSearchPageGreeting.homepage=https://yacy.net" --replace_string="promoteSearchPageGreeting.homepage=https://$domain$path_url" --target_file="$datadir/DATA/SETTINGS/yacy.conf"
-
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# INTEGRATE SERVICE IN YUNOHOST
-#=================================================
-ynh_script_progression --message="Integrating service in YunoHost..."
-
-yunohost service add $app --log="$datadir/DATA/LOG/yacy00.log"
+ynh_replace_string --target_file="$data_dir/DATA/SETTINGS/yacy.conf" \
+ --match_string="promoteSearchPageGreeting.homepage=https://yacy.net" \
+ --replace_string="promoteSearchPageGreeting.homepage=https://$domain$path"
#=================================================
# START SYSTEMD SERVICE
@@ -152,23 +55,7 @@ yunohost service add $app --log="$datadir/DATA/LOG/yacy00.log"
ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
-ynh_systemd_action --service_name=$app --action="start" --log_path="$datadir/DATA/LOG/yacy00.log" --line_match="Started httpd:"
-
-#=================================================
-# SETUP SSOWAT
-#=================================================
-ynh_script_progression --message="Configuring permissions..."
-
-# Everyone can access the app.
-# The "main" permission is automatically created before the install script.
-ynh_permission_update --permission="main" --add="visitors"
-
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..."
-
-ynh_systemd_action --service_name=nginx --action=reload
+ynh_systemd_action --service_name="$app" --action="start" --log_path="$data_dir/DATA/LOG/yacy00.log" --line_match="Started httpd:"
#=================================================
# END OF SCRIPT
diff --git a/scripts/remove b/scripts/remove
index 12591d2..a4e199e 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -10,91 +10,22 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..."
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-datadir=$(ynh_app_setting_get --app=$app --key=datadir)
-
-#=================================================
-# STANDARD REMOVE
-#=================================================
-# REMOVE SERVICE INTEGRATION IN YUNOHOST
+# REMOVE SYSTEM CONFIGURATIONS
#=================================================
+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
-then
- ynh_script_progression --message="Removing $app service integration..."
- yunohost service remove $app
+if ynh_exec_warn_less yunohost service status $app >/dev/null; then
+ ynh_script_progression --message="Removing $app service integration..."
+ yunohost service remove $app
fi
-#=================================================
-# STOP AND REMOVE SERVICE
-#=================================================
-ynh_script_progression --message="Stopping and removing the systemd service..."
-
# Remove the dedicated systemd config
ynh_remove_systemd_config
-#=================================================
-# REMOVE APP MAIN DIR
-#=================================================
-ynh_script_progression --message="Removing app main directory..."
-
-# Remove the app directory securely
-ynh_secure_remove --file="$final_path"
-
-#=================================================
-# REMOVE DATA DIR
-#=================================================
-
-# Remove the data directory if --purge option is used
-if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
-then
- ynh_script_progression --message="Removing app data directory..."
- ynh_secure_remove --file="$datadir"
-fi
-
-#=================================================
-# REMOVE NGINX CONFIGURATION
-#=================================================
-ynh_script_progression --message="Removing NGINX web server configuration..."
-
# Remove the dedicated NGINX config
ynh_remove_nginx_config
-#=================================================
-# REMOVE DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Removing dependencies..."
-
-# Remove metapackage and its dependencies
-ynh_remove_app_dependencies
-
-
-#=================================================
-# SPECIFIC REMOVE
-#=================================================
-# REMOVE VARIOUS FILES
-#=================================================
-ynh_script_progression --message="Removing various files..."
-
-
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# REMOVE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Removing the dedicated system user..."
-
-# Delete a system user
-ynh_system_user_delete --username=$app
-
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/scripts/restore b/scripts/restore
index f68ac69..f50e19e 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -10,115 +10,45 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
- ynh_clean_check_starting
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..."
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-path_url=$(ynh_app_setting_get --app=$app --key=path)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-datadir=$(ynh_app_setting_get --app=$app --key=datadir)
-
-#=================================================
-# CHECK IF THE APP CAN BE RESTORED
-#=================================================
-ynh_script_progression --message="Validating restoration parameters..."
-
-test ! -d $final_path \
- || ynh_die --message="There is already a directory: $final_path "
-
-#=================================================
-# STANDARD RESTORATION STEPS
-#=================================================
-# RECREATE THE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Recreating the dedicated system user..."
-
-# Create the dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir="$final_path"
-
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
-ynh_restore_file --origin_path="$final_path"
+ynh_restore_file --origin_path="$install_dir"
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app:www-data "$final_path"
+chmod 750 "$install_dir"
+chmod -R o-rwx "$install_dir"
+chown -R "$app:www-data" "$install_dir"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..."
-ynh_restore_file --origin_path="$datadir" --not_mandatory
+ynh_restore_file --origin_path="$data_dir" --not_mandatory
-mkdir -p $datadir
-
-chmod 750 "$datadir"
-chmod -R o-rwx "$datadir"
-chown -R $app:www-data "$datadir"
+chmod 750 "$data_dir"
+chmod -R o-rwx "$data_dir"
+chown -R "$app:www-data" "$data_dir"
#=================================================
-# SPECIFIC RESTORATION
+# RESTORE SYSTEM CONFIGURATIONS
#=================================================
-# REINSTALL DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Reinstalling dependencies..."
-
-# 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_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
-#=================================================
-# RESTORE SYSTEMD
-#=================================================
-ynh_script_progression --message="Restoring the systemd configuration..."
-
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
-systemctl enable $app.service --quiet
+systemctl enable "$app.service" --quiet
+yunohost service add "$app" --log="$data_dir/DATA/LOG/yacy00.log"
#=================================================
-# INTEGRATE SERVICE IN YUNOHOST
+# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
-ynh_script_progression --message="Integrating service in YunoHost..."
+ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
-yunohost service add $app --log="$datadir/DATA/LOG/yacy00.log"
-
-#=================================================
-# START SYSTEMD SERVICE
-#=================================================
-ynh_script_progression --message="Starting a systemd service..."
-
-ynh_systemd_action --service_name=$app --action="start" --log_path="$datadir/DATA/LOG/yacy00.log" --line_match="Started httpd:"
-
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
+ynh_systemd_action --service_name="$app" --action="start" --log_path="$data_dir/DATA/LOG/yacy00.log" --line_match="Started httpd:"
ynh_systemd_action --service_name=nginx --action=reload
diff --git a/scripts/upgrade b/scripts/upgrade
index c8a6b00..6a3edbe 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -9,43 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..."
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-path_url=$(ynh_app_setting_get --app=$app --key=path)
-language=$(ynh_app_setting_get --app=$app --key=language)
-admin=$(ynh_app_setting_get --app=$app --key=admin)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-datadir=$(ynh_app_setting_get --app=$app --key=datadir)
-port=$(ynh_app_setting_get --app=$app --key=port)
-
-#=================================================
-# CHECK VERSION
-#=================================================
-ynh_script_progression --message="Checking version..."
-
-upgrade_type=$(ynh_check_app_version_changed)
-
-#=================================================
-# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
-#=================================================
-ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
-
-# Backup the current version of the app
-ynh_backup_before_upgrade
-ynh_clean_setup () {
- ynh_clean_check_starting
- # Restore it if the upgrade fails
- ynh_restore_upgradebackup
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@@ -53,59 +16,38 @@ ynh_abort_if_errors
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
-ynh_systemd_action --service_name=$app --action="stop" --log_path="$datadir/DATA/LOG/yacy00.log"
+ynh_systemd_action --service_name="$app" --action="stop" --log_path="$data_dir/DATA/LOG/yacy00.log"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
-ynh_script_progression --message="Ensuring downward compatibility..."
-
-# Cleaning legacy permissions
-if ynh_legacy_permissions_exists; then
- ynh_legacy_permissions_delete_all
-
- ynh_app_setting_delete --app=$app --key=is_public
-fi
-
-#=================================================
-# CREATE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Making sure dedicated system user exists..."
-
-# Create a dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir="$final_path"
+# ynh_script_progression --message="Ensuring downward compatibility..."
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
+ynh_script_progression --message="Upgrading source files..."
-if [ "$upgrade_type" == "UPGRADE_APP" ]
-then
- ynh_script_progression --message="Upgrading source files..."
+# Download, check integrity, uncompress and patch the source from app.src
+ynh_setup_source --dest_dir="$install_dir" --full_replace
- # Download, check integrity, uncompress and patch the source from app.src
- ynh_setup_source --dest_dir="$final_path"
-fi
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app:www-data "$final_path"
+chmod 750 "$install_dir"
+chmod -R o-rwx "$install_dir"
+chown -R "$app:www-data" "$install_dir"
#=================================================
-# UPGRADE DEPENDENCIES
+# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
-ynh_script_progression --message="Upgrading dependencies..."
-
-ynh_install_app_dependencies $pkg_dependencies
-
-#=================================================
-# NGINX CONFIGURATION
-#=================================================
-ynh_script_progression --message="Upgrading NGINX web server configuration..."
+ynh_script_progression --message="Upgrading 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" --log="$data_dir/DATA/LOG/yacy00.log"
+
#=================================================
# SPECIFIC UPGRADE
#=================================================
@@ -113,38 +55,16 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Updating a configuration file..."
-ynh_replace_string --match_string="promoteSearchPageGreeting.homepage=https://yacy.net" --replace_string="promoteSearchPageGreeting.homepage=https://$domain$path_url" --target_file="$datadir/DATA/SETTINGS/yacy.conf"
-
-#=================================================
-# SETUP SYSTEMD
-#=================================================
-ynh_script_progression --message="Upgrading systemd configuration..."
-
-# Create a dedicated systemd config
-ynh_add_systemd_config
-
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# INTEGRATE SERVICE IN YUNOHOST
-#=================================================
-ynh_script_progression --message="Integrating service in YunoHost..."
-
-yunohost service add $app --log="$datadir/DATA/LOG/yacy00.log"
+ynh_replace_string --target_file="$data_dir/DATA/SETTINGS/yacy.conf" \
+ --match_string="promoteSearchPageGreeting.homepage=https://yacy.net" \
+ --replace_string="promoteSearchPageGreeting.homepage=https://$domain$path"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
-ynh_systemd_action --service_name=$app --action="start" --log_path="$datadir/DATA/LOG/yacy00.log" --line_match="Started httpd:"
-
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..."
-
-ynh_systemd_action --service_name=nginx --action=reload
+ynh_systemd_action --service_name="$app" --action="start" --log_path="$data_dir/DATA/LOG/yacy00.log" --line_match="Started httpd:"
#=================================================
# END OF SCRIPT
diff --git a/tests.toml b/tests.toml
new file mode 100644
index 0000000..612a732
--- /dev/null
+++ b/tests.toml
@@ -0,0 +1,9 @@
+test_format = 1.0
+
+[default]
+
+ # ------------
+ # Tests to run
+ # ------------
+
+ test_upgrade_from.ca4d54e5e6c1bc7d772e375f6193b46f886034a5.name = "1.0~ynh1"