From 253ff67cda6fb440d90666b8f66e1e1eee36f1f2 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sat, 31 Aug 2024 03:01:29 +0200 Subject: [PATCH] [autopatch] Automatic patch attempt for helpers 2.1 --- .gitignore | 1 + manifest.toml | 3 ++- scripts/_common.sh | 14 +--------- scripts/backup | 19 ++++--------- scripts/change_url | 44 ++++++++++++------------------- scripts/config | 13 ++++----- scripts/install | 55 ++++++++++++++++---------------------- scripts/remove | 23 +++++++--------- scripts/restore | 29 +++++++------------- scripts/upgrade | 66 ++++++++++++++++++++-------------------------- 10 files changed, 101 insertions(+), 166 deletions(-) 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/manifest.toml b/manifest.toml index 2b2f0e7..36aeab0 100644 --- a/manifest.toml +++ b/manifest.toml @@ -16,7 +16,8 @@ website = "https://simplytranslate.org/" code = "https://codeberg.org/SimpleWeb/SimplyTranslate-Web" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = true ldap = false 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 a151df9..0a4e5aa 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,30 +1,21 @@ #!/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" #================================================= # 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" #================================================= # SPECIFIC BACKUP @@ -32,10 +23,10 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP SYSTEMD #================================================= -ynh_backup --src_path="/etc/systemd/system/$app.service" +ynh_backup "/etc/systemd/system/$app.service" #================================================= # 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 7e622b5..b918d62 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="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="stop" #================================================= # 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 @@ -45,28 +37,26 @@ then new_st_path=$new_path fi - ynh_replace_string -m "\"$old_st_path/?engine" -r "\"$new_st_path/?engine" -f "$install_dir/simplytranslate/templates/index.html" - ynh_replace_string -m "$old_st_path/prefs" -r "$new_st_path/prefs" -f "$install_dir/simplytranslate/templates/index.html" - ynh_replace_string -m "$old_st_path/switchlanguages" -r "$new_st_path/switchlanguages" -f "$install_dir/simplytranslate/templates/index.html" - ynh_replace_string -m "\"$old_st_path/\"" -r "\"$new_st_path/\"" -f "$install_dir/simplytranslate/templates/prefs.html" - ynh_replace_string -m "$old_st_path/prefs" -r "$new_st_path/prefs" -f "$install_dir/simplytranslate/templates/prefs.html" - ynh_replace_string -m "$old_st_path/api" -r "$new_st_path/api" -f "$install_dir/simplytranslate/main.py" - ynh_replace_string -m "$old_st_path/prefs" -r "$new_st_path/prefs" -f "$install_dir/simplytranslate/main.py" - ynh_replace_string -m "$old_st_path/switchlanguages" -r "$new_st_path/switchlanguages" -f "$install_dir/simplytranslate/main.py" - ynh_replace_string -m "f\"$old_st_path/?" -r "f\"$new_st_path/?" -f "$install_dir/simplytranslate/main.py" - ynh_replace_string -m "\"$old_st_path/\"" -r "\"$new_st_path/\"" -f "$install_dir/simplytranslate/main.py" + ynh_replace -m "\"$old_st_path/?engine" -r "\"$new_st_path/?engine" -f "$install_dir/simplytranslate/templates/index.html" + ynh_replace -m "$old_st_path/prefs" -r "$new_st_path/prefs" -f "$install_dir/simplytranslate/templates/index.html" + ynh_replace -m "$old_st_path/switchlanguages" -r "$new_st_path/switchlanguages" -f "$install_dir/simplytranslate/templates/index.html" + ynh_replace -m "\"$old_st_path/\"" -r "\"$new_st_path/\"" -f "$install_dir/simplytranslate/templates/prefs.html" + ynh_replace -m "$old_st_path/prefs" -r "$new_st_path/prefs" -f "$install_dir/simplytranslate/templates/prefs.html" + ynh_replace -m "$old_st_path/api" -r "$new_st_path/api" -f "$install_dir/simplytranslate/main.py" + ynh_replace -m "$old_st_path/prefs" -r "$new_st_path/prefs" -f "$install_dir/simplytranslate/main.py" + ynh_replace -m "$old_st_path/switchlanguages" -r "$new_st_path/switchlanguages" -f "$install_dir/simplytranslate/main.py" + ynh_replace -m "f\"$old_st_path/?" -r "f\"$new_st_path/?" -f "$install_dir/simplytranslate/main.py" + ynh_replace -m "\"$old_st_path/\"" -r "\"$new_st_path/\"" -f "$install_dir/simplytranslate/main.py" fi #================================================= -# GENERIC FINALISATION -#================================================= # 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="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="start" #================================================= # 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 7fc3785..958be91 100644 --- a/scripts/config +++ b/scripts/config @@ -2,13 +2,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) port=$(ynh_app_setting_get -a $app -k port) #================================================= @@ -18,15 +18,12 @@ port=$(ynh_app_setting_get -a $app -k port) ynh_app_config_apply() { _ynh_app_config_apply - ynh_add_config --template="config.conf.template" --destination="$install_dir/simplytranslate/config.conf" + ynh_config_add --template="config.conf.template" --destination="$install_dir/simplytranslate/config.conf" - chmod 400 "$install_dir/simplytranslate/config.conf" - chown $app:$app "$install_dir/simplytranslate/config.conf" + #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/simplytranslate/config.conf" + #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/simplytranslate/config.conf" } -#================================================= -# GENERIC FINALIZATION #================================================= ynh_app_config_run $1 - diff --git a/scripts/install b/scripts/install index 250687c..8d2acd5 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 @@ -14,20 +8,19 @@ source /usr/share/yunohost/helpers #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +ynh_script_progression "Setting up source files..." ynh_setup_source --dest_dir="$install_dir/simplytranslate" -chown -R $app: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 $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="Web interface for SimplyTranslate" --log="/var/log/$app/$app.log" @@ -36,7 +29,7 @@ yunohost service add $app --description="Web interface for SimplyTranslate" --lo #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 +ynh_script_progression "Adding $app's configuration..." # some default config ynh_app_setting_set -a $app -k libretranslate_enable -v false @@ -56,10 +49,10 @@ deepl_enable=$(ynh_app_setting_get -a $app -k deepl_enable) iciba_enable=$(ynh_app_setting_get -a $app -k iciba_enable) reverso_enable=$(ynh_app_setting_get -a $app -k reverso_enable) -ynh_add_config --template="config.conf.template" --destination="$install_dir/simplytranslate/config.conf" +ynh_config_add --template="config.conf.template" --destination="$install_dir/simplytranslate/config.conf" -chmod 400 "$install_dir/simplytranslate/config.conf" -chown $app:$app "$install_dir/simplytranslate/config.conf" +#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/simplytranslate/config.conf" +#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/simplytranslate/config.conf" #================================================= # CONFIGURATION FOR SUBPATH @@ -71,21 +64,21 @@ else st_path=$path fi -ynh_replace_string -m "\"/?engine" -r "\"$st_path/?engine" -f "$install_dir/simplytranslate/templates/index.html" -ynh_replace_string -m "/prefs" -r "$st_path/prefs" -f "$install_dir/simplytranslate/templates/index.html" -ynh_replace_string -m "/switchlanguages" -r "$st_path/switchlanguages" -f "$install_dir/simplytranslate/templates/index.html" -ynh_replace_string -m "\"/\"" -r "\"$st_path/\"" -f "$install_dir/simplytranslate/templates/prefs.html" -ynh_replace_string -m "/prefs" -r "$st_path/prefs" -f "$install_dir/simplytranslate/templates/prefs.html" -ynh_replace_string -m "/api" -r "$st_path/api" -f "$install_dir/simplytranslate/main.py" -ynh_replace_string -m "/prefs" -r "$st_path/prefs" -f "$install_dir/simplytranslate/main.py" -ynh_replace_string -m "/switchlanguages" -r "$st_path/switchlanguages" -f "$install_dir/simplytranslate/main.py" -ynh_replace_string -m "f\"/?" -r "f\"$st_path/?" -f "$install_dir/simplytranslate/main.py" -ynh_replace_string -m "\"/\"" -r "\"$st_path/\"" -f "$install_dir/simplytranslate/main.py" +ynh_replace -m "\"/?engine" -r "\"$st_path/?engine" -f "$install_dir/simplytranslate/templates/index.html" +ynh_replace -m "/prefs" -r "$st_path/prefs" -f "$install_dir/simplytranslate/templates/index.html" +ynh_replace -m "/switchlanguages" -r "$st_path/switchlanguages" -f "$install_dir/simplytranslate/templates/index.html" +ynh_replace -m "\"/\"" -r "\"$st_path/\"" -f "$install_dir/simplytranslate/templates/prefs.html" +ynh_replace -m "/prefs" -r "$st_path/prefs" -f "$install_dir/simplytranslate/templates/prefs.html" +ynh_replace -m "/api" -r "$st_path/api" -f "$install_dir/simplytranslate/main.py" +ynh_replace -m "/prefs" -r "$st_path/prefs" -f "$install_dir/simplytranslate/main.py" +ynh_replace -m "/switchlanguages" -r "$st_path/switchlanguages" -f "$install_dir/simplytranslate/main.py" +ynh_replace -m "f\"/?" -r "f\"$st_path/?" -f "$install_dir/simplytranslate/main.py" +ynh_replace -m "\"/\"" -r "\"$st_path/\"" -f "$install_dir/simplytranslate/main.py" #================================================= # BUILD THE APP #================================================= -ynh_script_progression --message="Building the app..." --weight=1 +ynh_script_progression "Building the app..." mkdir "$install_dir/venv" python3 -m venv "$install_dir/venv" @@ -93,16 +86,14 @@ python3 -m venv "$install_dir/venv" chown -R $app:$app "$install_dir/venv" -#================================================= -# GENERIC FINALIZATION #================================================= # 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="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="start" #================================================= # 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 ab8f44d..7cc7c2a 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,33 +1,28 @@ #!/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 +# REMOVE SYSTEMD SERVICE -if ynh_exec_warn_less yunohost service status $app >/dev/null +#================================================= +ynh_script_progression "Removing system configurations related to $app..." + +if ynh_hide_warnings yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service integration..." --weight=1 + ynh_script_progression "Removing $app service integration..." yunohost service remove $app fi -ynh_remove_systemd_config +ynh_config_remove_systemd -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 877c52c..1c0252b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,50 +1,41 @@ #!/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 the app main directory..." --weight=1 +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" - -chown -R $app: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 $app:www-data "$install_dir" #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -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="Web interface for SimplyTranslate" --log="/var/log/$app/$app.log" -#================================================= -# GENERIC FINALIZATION #================================================= # 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="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="start" -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 590c396..132e545 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,16 +1,8 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # IMPORT SOME CONFIG #================================================= @@ -24,14 +16,12 @@ iciba_enable=$(ynh_app_setting_get -a $app -k iciba_enable) reverso_enable=$(ynh_app_setting_get -a $app -k reverso_enable) port=$(ynh_app_setting_get -a $app -k port) -#================================================= -# 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="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="stop" #================================================= # "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) @@ -39,15 +29,15 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app # 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..." ynh_setup_source --dest_dir="$install_dir/simplytranslate" fi -chown -R $app: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 $app:www-data "$install_dir" #================================================= # CONFIGURATION FOR SUBPATH #================================================= @@ -58,25 +48,25 @@ else st_path=$path fi -ynh_replace_string -m "\"/?engine" -r "\"$st_path/?engine" -f "$install_dir/simplytranslate/templates/index.html" -ynh_replace_string -m "/prefs" -r "$st_path/prefs" -f "$install_dir/simplytranslate/templates/index.html" -ynh_replace_string -m "/switchlanguages" -r "$st_path/switchlanguages" -f "$install_dir/simplytranslate/templates/index.html" -ynh_replace_string -m "\"/\"" -r "\"$st_path/\"" -f "$install_dir/simplytranslate/templates/prefs.html" -ynh_replace_string -m "/prefs" -r "$st_path/prefs" -f "$install_dir/simplytranslate/templates/prefs.html" -ynh_replace_string -m "/api" -r "$st_path/api" -f "$install_dir/simplytranslate/main.py" -ynh_replace_string -m "/prefs" -r "$st_path/prefs" -f "$install_dir/simplytranslate/main.py" -ynh_replace_string -m "/switchlanguages" -r "$st_path/switchlanguages" -f "$install_dir/simplytranslate/main.py" -ynh_replace_string -m "f\"/?" -r "f\"$st_path/?" -f "$install_dir/simplytranslate/main.py" -ynh_replace_string -m "\"/\"" -r "\"$st_path/\"" -f "$install_dir/simplytranslate/main.py" +ynh_replace -m "\"/?engine" -r "\"$st_path/?engine" -f "$install_dir/simplytranslate/templates/index.html" +ynh_replace -m "/prefs" -r "$st_path/prefs" -f "$install_dir/simplytranslate/templates/index.html" +ynh_replace -m "/switchlanguages" -r "$st_path/switchlanguages" -f "$install_dir/simplytranslate/templates/index.html" +ynh_replace -m "\"/\"" -r "\"$st_path/\"" -f "$install_dir/simplytranslate/templates/prefs.html" +ynh_replace -m "/prefs" -r "$st_path/prefs" -f "$install_dir/simplytranslate/templates/prefs.html" +ynh_replace -m "/api" -r "$st_path/api" -f "$install_dir/simplytranslate/main.py" +ynh_replace -m "/prefs" -r "$st_path/prefs" -f "$install_dir/simplytranslate/main.py" +ynh_replace -m "/switchlanguages" -r "$st_path/switchlanguages" -f "$install_dir/simplytranslate/main.py" +ynh_replace -m "f\"/?" -r "f\"$st_path/?" -f "$install_dir/simplytranslate/main.py" +ynh_replace -m "\"/\"" -r "\"$st_path/\"" -f "$install_dir/simplytranslate/main.py" #================================================= # 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_add_systemd_config +ynh_config_add_systemd yunohost service add $app --description="Web interface for SimplyTranslate" --log="/var/log/$app/$app.log" @@ -85,19 +75,19 @@ yunohost service add $app --description="Web interface for SimplyTranslate" --lo #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a configuration file..." --weight=1 +ynh_script_progression "Updating configuration..." -ynh_add_config --template="config.conf.template" --destination="$install_dir/simplytranslate/config.conf" +ynh_config_add --template="config.conf.template" --destination="$install_dir/simplytranslate/config.conf" -chmod 400 "$install_dir/simplytranslate/config.conf" -chown $app:$app "$install_dir/simplytranslate/config.conf" +#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/simplytranslate/config.conf" +#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/simplytranslate/config.conf" #================================================= # REBUILDING THE APP #================================================= -ynh_script_progression --message="Rebuilding the app..." --weight=1 +ynh_script_progression "Rebuilding the app..." -ynh_secure_remove "$install_dir/venv" +ynh_safe_rm "$install_dir/venv" mkdir "$install_dir/venv" python3 -m venv "$install_dir/venv" "$install_dir/venv/bin/python3" -m pip install -r "$install_dir/simplytranslate/requirements.txt" @@ -107,12 +97,12 @@ chown -R $app:$app "$install_dir/venv" #================================================= # 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="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="start" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"