diff --git a/.gitignore b/.gitignore
index 783a4ae..8f144f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
*~
*.sw[op]
+.DS_Store
diff --git a/doc/.DS_Store b/doc/.DS_Store
deleted file mode 100644
index b5e9f00..0000000
Binary files a/doc/.DS_Store and /dev/null differ
diff --git a/manifest.toml b/manifest.toml
index ff5fb68..6d4dde7 100644
--- a/manifest.toml
+++ b/manifest.toml
@@ -22,7 +22,8 @@ code = "https://github.com/krille-chan/fluffychat"
fund = "https://ko-fi.com/krille"
[integration]
-yunohost = ">= 11.2"
+yunohost = ">= 11.2.18"
+helpers_version = "2.1"
architectures = "all"
multi_instance = true
@@ -71,6 +72,7 @@ ram.runtime = "50M"
autoupdate.strategy = "latest_github_release"
[resources.install_dir]
+group = "www-data:r-x"
owner = "www-data:rx"
group = "www-data:rx"
diff --git a/scripts/_common.sh b/scripts/_common.sh
index 944a65e..3d7f008 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -1,17 +1,5 @@
#!/bin/bash
#=================================================
-# COMMON VARIABLES
-#=================================================
-
-#=================================================
-# PERSONAL HELPERS
-#=================================================
-
-#=================================================
-# EXPERIMENTAL HELPERS
-#=================================================
-
-#=================================================
-# FUTURE OFFICIAL HELPERS
+# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
diff --git a/scripts/backup b/scripts/backup
index 52eea5b..af443d9 100755
--- a/scripts/backup
+++ b/scripts/backup
@@ -1,34 +1,25 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
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"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
-ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
+ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# 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 26cd413..f78cea0 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -1,20 +1,14 @@
#!/bin/bash
-#=================================================
-# GENERIC STARTING
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# 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
@@ -22,10 +16,10 @@ ynh_change_url_nginx_config
# remove potential trailing slash to avoid double slashes
path_without_trailing_slash=${path%/}
-ynh_replace_string --match_string="" --replace_string="" --target_file="$install_dir/index.html"
+ynh_replace --match="" --replace="" --file="$install_dir/index.html"
#=================================================
# 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/config b/scripts/config
index b3fd972..0d81cba 100644
--- a/scripts/config
+++ b/scripts/config
@@ -6,13 +6,13 @@
source /usr/share/yunohost/helpers
-ynh_abort_if_errors
+#REMOVEME? ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
-install_dir=$(ynh_app_setting_get --app="$app" --key=install_dir)
+install_dir=$(ynh_app_setting_get --key=install_dir)
#=================================================
# SPECIFIC GETTERS
@@ -20,7 +20,7 @@ install_dir=$(ynh_app_setting_get --app="$app" --key=install_dir)
get__default_matrix_server() {
- default_matrix_server=$(ynh_app_setting_get --app="$app" --key=default_matrix_server)
+ default_matrix_server=$(ynh_app_setting_get --key=default_matrix_server)
echo "$default_matrix_server"
}
@@ -34,12 +34,10 @@ set__default_matrix_server() {
old_value=${old[default_matrix_server]}
# patching main.dart.js to replace the default matrix server
- ynh_replace_string --match_string="=\"$old_value\"" --replace_string="=\"$default_matrix_server\"" --target_file="$install_dir/main.dart.js"
+ ynh_replace --match="=\"$old_value\"" --replace="=\"$default_matrix_server\"" --file="$install_dir/main.dart.js"
- ynh_app_setting_set --app="$app" --key=default_matrix_server --value="$default_matrix_server"
+ ynh_app_setting_set --key=default_matrix_server --value="$default_matrix_server"
}
-#=================================================
-# GENERIC FINALIZATION
#=================================================
ynh_app_config_run "$1"
diff --git a/scripts/install b/scripts/install
index 4980e9f..7f9e3a1 100755
--- 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
@@ -17,36 +11,35 @@ source /usr/share/yunohost/helpers
default_matrix_server=${default_matrix_server#*://}
# remove any trailing slash
default_matrix_server=${default_matrix_server%/}
-ynh_app_setting_set --app="$app" --key=default_matrix_server --value="$default_matrix_server"
+ynh_app_setting_set --key=default_matrix_server --value="$default_matrix_server"
#=================================================
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
-ynh_script_progression --message="Setting up source files..." --weight=1
+ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from manifest.toml
ynh_setup_source --dest_dir="$install_dir"
# remove potential trailing slash to avoid double slashes
path_without_trailing_slash=${path%/}
-ynh_replace_string --match_string="" --replace_string="" --target_file="$install_dir/index.html"
+ynh_replace --match="" --replace="" --file="$install_dir/index.html"
# patching main.dart.js to replace the default matrix server
-ynh_replace_string --match_string="=\"matrix.org\"" --replace_string="=\"$default_matrix_server\"" --target_file="$install_dir/main.dart.js"
-
-chown -R "www-data:www-data" "$install_dir"
+ynh_replace --match="=\"matrix.org\"" --replace="=\"$default_matrix_server\"" --file="$install_dir/main.dart.js"
+#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "www-data: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..."
# Create a dedicated NGINX config using the conf/nginx.conf template
-ynh_add_nginx_config
+ynh_config_add_nginx
#=================================================
# 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 ad629d0..33f9552 100755
--- a/scripts/remove
+++ b/scripts/remove
@@ -1,23 +1,17 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
-ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
+ynh_script_progression "Removing system configurations related to $app..."
-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 cd7a2ea..bfe5eae 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -1,11 +1,5 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@@ -13,30 +7,27 @@ source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
-ynh_script_progression --message="Restoring the app main directory..." --weight=1
+ynh_script_progression "Restoring the app main directory..."
-ynh_restore_file --origin_path="$install_dir"
-
-chown -R "www-data:www-data" "$install_dir"
+ynh_restore "$install_dir"
+#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "www-data:www-data" "$install_dir"
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
-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"
-#=================================================
-# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=1
+ynh_script_progression "Reloading NGINX web server..."
-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 442dc95..fe315ea 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -1,20 +1,13 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source _common.sh
source /usr/share/yunohost/helpers
-upgrade_type=$(ynh_check_app_version_changed)
-
# if we update from a version prior to the config panel, create new setting
+# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=default_matrix_server --value="matrix.org"
if [ -z "${default_matrix_server:-}" ]; then
default_matrix_server="matrix.org"
- ynh_app_setting_set --app="$app" --key=default_matrix_server --value="$default_matrix_server"
+ ynh_app_setting_set --key=default_matrix_server --value="$default_matrix_server"
fi
#=================================================
@@ -23,32 +16,32 @@ fi
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
-if [ "$upgrade_type" == "UPGRADE_APP" ]
+# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
+if ynh_app_upstream_version_changed
then
- ynh_script_progression --message="Upgrading source files..." --weight=1
+ ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from manifest.toml
- ynh_setup_source --dest_dir="$install_dir" --full_replace=1
+ ynh_setup_source --dest_dir="$install_dir" --full_replace
# remove potential trailing slash to avoid double slashes
path_without_trailing_slash=${path%/}
- ynh_replace_string --match_string="" --replace_string="" --target_file="$install_dir/index.html"
+ ynh_replace --match="" --replace="" --file="$install_dir/index.html"
# patching main.dart.js to replace the default matrix server
- ynh_replace_string --match_string="=\"matrix.org\"" --replace_string="=\"$default_matrix_server\"" --target_file="$install_dir/main.dart.js"
+ ynh_replace --match="=\"matrix.org\"" --replace="=\"$default_matrix_server\"" --file="$install_dir/main.dart.js"
fi
-chown -R "www-data:www-data" "$install_dir"
-
+#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "www-data: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
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Upgrade of $app completed" --last
+ynh_script_progression "Upgrade of $app completed"
diff --git a/sources/extra_files/app/.gitignore b/sources/extra_files/app/.gitignore
deleted file mode 100644
index 783a4ae..0000000
--- a/sources/extra_files/app/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*~
-*.sw[op]
diff --git a/sources/patches/.gitignore b/sources/patches/.gitignore
deleted file mode 100644
index 783a4ae..0000000
--- a/sources/patches/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*~
-*.sw[op]