From 33ca6f7ad5b447904c4e3cd32f869b3b09d37a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 5 Apr 2023 23:07:17 +0200 Subject: [PATCH] fix --- conf/front.src | 6 ------ manifest.toml | 2 +- scripts/backup | 19 ------------------- scripts/change_url | 45 ++------------------------------------------- scripts/install | 2 +- scripts/restore | 8 -------- scripts/upgrade | 23 +++++++++++------------ 7 files changed, 15 insertions(+), 90 deletions(-) delete mode 100644 conf/front.src diff --git a/conf/front.src b/conf/front.src deleted file mode 100644 index ca5192e..0000000 --- a/conf/front.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://dl.vikunja.io/frontend/vikunja-frontend-0.20.3.zip -SOURCE_SUM=f95b5d81b25a5dc3e53bbd06aacbabea8b016fb880bd59cfbf689a1dbb364669 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=zip -SOURCE_IN_SUBDIR=false -SOURCE_EXTRACT=true \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index 4c97d6a..7dfe2e0 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://vikunja.io/docs/" code = "https://kolaente.dev/vikunja/" [integration] -yunohost = ">= 11.1.15" +yunohost = ">= 11.1.17" architectures = "all" multi_instance = true ldap = false diff --git a/scripts/backup b/scripts/backup index 8d24919..64e1a14 100644 --- a/scripts/backup +++ b/scripts/backup @@ -9,25 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? backend_path=$(ynh_app_setting_get --app=$app --key=backend_path) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index c4e3c55..db32764 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -12,28 +12,10 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -backend_path=$(ynh_app_setting_get --app=$app --key=backend_path) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) secret=$(ynh_string_random --length=32) timezone="$(cat /etc/timezone)" - -set_motd=$(ynh_app_setting_get --app=$app --key=set_motd) -enable_registration=$(ynh_app_setting_get --app=$app --key=enable_registration) -enable_linksharing=$(ynh_app_setting_get --app=$app --key=enable_linksharing) -enable_taskattachments=$(ynh_app_setting_get --app=$app --key=enable_taskattachments) -enable_taskcomments=$(ynh_app_setting_get --app=$app --key=enable_taskcomments) -enable_emailreminders=$(ynh_app_setting_get --app=$app --key=enable_emailreminders) -enable_userdeletion=$(ynh_app_setting_get --app=$app --key=enable_userdeletion) -maxavatarsize=$(ynh_app_setting_get --app=$app --key=maxavatarsize) -maxitemsperpage=$(ynh_app_setting_get --app=$app --key=maxitemsperpage) - +redis_db=$(ynh_redis_get_free_db) #================================================= # STANDARD MODIFICATIONS @@ -49,29 +31,7 @@ ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$ #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 -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 #================================================= # ADD A CONFIGURATION @@ -80,7 +40,6 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 domain="$new_domain" path="$new_path" -redis_db=$(ynh_redis_get_free_db) ynh_add_config --template="../conf/config.yml" --destination="$backend_path/config.yml" chmod 600 "$backend_path/config.yml" diff --git a/scripts/install b/scripts/install index 0c5cff1..c95c5d9 100644 --- a/scripts/install +++ b/scripts/install @@ -69,7 +69,7 @@ ynh_app_setting_set --app=$app --key=backend_path --value=$backend_path mkdir -p "$backend_path" mkdir -p "$backend_path/files" tempdir="$(mktemp -d)" -ynh_setup_source --dest_dir=$tempdir --source_id=$YNH_ARCH +ynh_setup_source --dest_dir=$tempdir --source_id="back" back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")" cp "$back" "$backend_path/vikunja" diff --git a/scripts/restore b/scripts/restore index 12f90e8..df9e294 100644 --- a/scripts/restore +++ b/scripts/restore @@ -18,14 +18,6 @@ ynh_script_progression --message="Restoring the NGINX configuration..." --weight ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # RESTORE THE APP MAIN DIR #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index fd7244b..5ce62ed 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -30,50 +30,50 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # If backend_path doesn't exist, create it if [ -z "$backend_path" ]; then backend_path=/opt/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=backend_path --value=$backend_path + ynh_app_setting_set --app=$app --key=backend_path --value=$backend_path fi -if [ -z "$set_motd" ]; then +if [ -z "${set_motd:-}" ]; then set_motd="" ynh_app_setting_set --app=$app --key=set_motd --value=$set_motd fi -if [ -z "$enable_registration" ]; then +if [ -z "${enable_registration:-}" ]; then enable_registration="true" ynh_app_setting_set --app=$app --key=enable_registration --value=$enable_registration fi -if [ -z "$enable_linksharing" ]; then +if [ -z "${enable_linksharing:-}" ]; then enable_linksharing="true" ynh_app_setting_set --app=$app --key=enable_linksharing --value=$enable_linksharing fi -if [ -z "$enable_taskattachments" ]; then +if [ -z "${enable_taskattachments:-}" ]; then enable_taskattachments="true" ynh_app_setting_set --app=$app --key=enable_taskattachments --value=$enable_taskattachments fi -if [ -z "$enable_taskcomments" ]; then +if [ -z "${enable_taskcomments:-}" ]; then enable_taskcomments="true" ynh_app_setting_set --app=$app --key=enable_taskcomments --value=$enable_taskcomments fi -if [ -z "$enable_emailreminders" ]; then +if [ -z "${enable_emailreminders:-}" ]; then enable_emailreminders="true" ynh_app_setting_set --app=$app --key=enable_emailreminders --value=$enable_emailreminders fi -if [ -z "$enable_userdeletion" ]; then +if [ -z "${enable_userdeletion:-}" ]; then enable_userdeletion="true" ynh_app_setting_set --app=$app --key=enable_userdeletion --value=$enable_userdeletion fi -if [ -z "$maxavatarsize" ]; then +if [ -z "${maxavatarsize:-}" ]; then maxavatarsize=1024 ynh_app_setting_set --app=$app --key=maxavatarsize --value=$maxavatarsize fi -if [ -z "$maxitemsperpage" ]; then +if [ -z "${maxitemsperpage:-}" ]; then maxitemsperpage=50 ynh_app_setting_set --app=$app --key=maxitemsperpage --value=$maxitemsperpage fi @@ -102,12 +102,11 @@ then # Backend mkdir -p "$backend_path/files" tempdir="$(mktemp -d)" - ynh_setup_source --dest_dir=$tempdir --source_id=$YNH_ARCH + ynh_setup_source --dest_dir=$tempdir --source_id="back" back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")" cp "$back" "$backend_path/vikunja" fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" chmod +x "$backend_path/vikunja"