From 26d128c485ebe0686cc685a332fb0af69f1048b5 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Fri, 30 Aug 2024 22:41:53 +0200 Subject: [PATCH] [autopatch] Automatic patch attempt for helpers 2.1 --- .gitignore | 1 + manifest.toml | 4 +- scripts/_common.sh | 14 +---- scripts/backup | 29 ++++------ scripts/install | 60 +++++++++------------ scripts/remove | 44 +++++++--------- scripts/restore | 55 ++++++++----------- scripts/upgrade | 85 ++++++++++++------------------ sources/extra_files/app/.gitignore | 2 - sources/patches/.gitignore | 2 - 10 files changed, 117 insertions(+), 179 deletions(-) delete mode 100644 sources/extra_files/app/.gitignore delete mode 100644 sources/patches/.gitignore 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 ad89445..75914d1 100644 --- a/manifest.toml +++ b/manifest.toml @@ -18,7 +18,8 @@ code = "https://github.com/bookwyrm-social/bookwyrm" cpe = "cpe:2.3:a:joinbookwyrm:bookwyrm" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = false ldap = false @@ -61,6 +62,7 @@ ram.runtime = "50M" allow_email = true [resources.install_dir] + group = "www-data:r-x" [resources.data_dir] 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 1187a94..9369ab1 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,50 +1,41 @@ #!/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" #================================================= # BACKUP SYSTEMD #================================================= -ynh_backup --src_path="/etc/systemd/system/$app-beat.service" -ynh_backup --src_path="/etc/systemd/system/$app-server.service" -ynh_backup --src_path="/etc/systemd/system/$app-worker.service" -ynh_backup --src_path="/etc/systemd/system/$app.target" +ynh_backup "/etc/systemd/system/$app-beat.service" +ynh_backup "/etc/systemd/system/$app-server.service" +ynh_backup "/etc/systemd/system/$app-worker.service" +ynh_backup "/etc/systemd/system/$app.target" #================================================= # BACKUP THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Backing up the PostgreSQL database..." +ynh_print_info "Backing up the PostgreSQL database..." -ynh_psql_dump_db --database="$db_name" > db.sql +ynh_psql_dump_db > db.sql #================================================= # 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/install b/scripts/install index a7ea36f..d335785 100755 --- a/scripts/install +++ b/scripts/install @@ -1,38 +1,31 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers key=$(ynh_string_random --length=32) -ynh_app_setting_set --app=$app --key=key --value=$key +ynh_app_setting_set --key=key --value=$key #================================================= # 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 app.src ynh_setup_source --dest_dir="$install_dir" --source_id="main" ynh_setup_source --dest_dir="$install_dir/static/fonts/source_han_sans" --source_id="fonts" # Set permissions to app files -chmod -R o-rwx "$install_dir" -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 | chmod -R o-rwx "$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" #================================================= # CONFIGURE THEN INSTALL SCRIPT AND DEPENDENCIES #================================================= -ynh_script_progression --message="Installing service script..." --weight=1 +ynh_script_progression "Installing service script..." -ynh_add_config --template="../conf/.env.production" --destination="$install_dir/.env" -chmod 600 $install_dir/.env -chown $app:www-data "$install_dir/.env" +ynh_config_add --template=".env.production" --destination="$install_dir/.env" +#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 600 $install_dir/.env +#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:www-data "$install_dir/.env" mkdir "$install_dir/venv" python3 -m venv "$install_dir/venv" @@ -41,7 +34,7 @@ $install_dir/venv/bin/pip3 install -r "$install_dir/requirements.txt" #================================================= # INITIALIZE DATABASE #================================================= -ynh_script_progression --message="Initializing database..." --weight=1 +ynh_script_progression "Initializing database..." pushd $install_dir $install_dir/venv/bin/python3 "$install_dir/manage.py" migrate @@ -53,41 +46,40 @@ popd #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 +ynh_script_progression "Configuring NGINX web server..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Configuring logrotate..." --weight=1 +ynh_script_progression "Configuring logrotate..." # Use logrotate to manage application logfile(s) -ynh_use_logrotate --specific_user=$app +ynh_config_add_logrotate + touch /var/log/$app/$app.log touch /var/log/$app/$app-beat.log touch /var/log/$app/$app-worker.log -chown -R $app:www-data /var/log/$app/ +#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data /var/log/$app/ #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 +ynh_script_progression "Configuring $app's systemd service..." -ynh_add_config --template="../conf/bookwyrm.target" --destination="/etc/systemd/system/$app.target" +ynh_config_add --template="bookwyrm.target" --destination="/etc/systemd/system/$app.target" # Create a dedicated systemd config -ynh_add_systemd_config --service="$app-server" --template="bookwyrm-server.service" -ynh_add_systemd_config --service="$app-worker" --template="bookwyrm-worker.service" -ynh_add_systemd_config --service="$app-beat" --template="bookwyrm-beat.service" +ynh_config_add_systemd --service="$app-server" --template="bookwyrm-server.service" +ynh_config_add_systemd --service="$app-worker" --template="bookwyrm-worker.service" +ynh_config_add_systemd --service="$app-beat" --template="bookwyrm-beat.service" -#================================================= -# GENERIC FINALIZATION #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression "Integrating service in YunoHost..." yunohost service add "$app-beat" --log="/var/log/$app/$app-beat.log" yunohost service add "$app-server" --log="/var/log/$app/$app.log" @@ -96,15 +88,15 @@ yunohost service add "$app-worker" --log="/var/log/$app/$app-worker.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." # Start a systemd service -ynh_systemd_action --service_name="$app-beat" --action="start" --log_path="systemd" --line_match="Started bookwyrm celery beat process" -ynh_systemd_action --service_name="$app-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" -ynh_systemd_action --service_name="$app-worker" --action="start" --log_path="systemd" --line_match="ready" +ynh_systemctl --service="$app-beat" --action="start" --log_path="systemd" --wait_until="Started bookwyrm celery beat process" +ynh_systemctl --service="$app-server" --action="start" --log_path="systemd" --wait_until="Booting worker with pid" +ynh_systemctl --service="$app-worker" --action="start" --log_path="systemd" --wait_until="ready" #================================================= # 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 83366b3..52d2011 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -16,57 +10,57 @@ source /usr/share/yunohost/helpers #================================================= # 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-server" >/dev/null +if ynh_hide_warnings yunohost service status "$app-server" >/dev/null then - ynh_script_progression --message="Removing $app-server service integration..." + ynh_script_progression "Removing $app-server service integration..." yunohost service remove "$app-server" fi -if ynh_exec_warn_less yunohost service status "$app-worker" >/dev/null +if ynh_hide_warnings yunohost service status "$app-worker" >/dev/null then - ynh_script_progression --message="Removing $app-worker service integration..." + ynh_script_progression "Removing $app-worker service integration..." yunohost service remove "$app-worker" fi -if ynh_exec_warn_less yunohost service status "$app-beat" >/dev/null +if ynh_hide_warnings yunohost service status "$app-beat" >/dev/null then - ynh_script_progression --message="Removing $app-beat service integration..." + ynh_script_progression "Removing $app-beat service integration..." yunohost service remove "$app-beat" fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 +ynh_script_progression "Stopping and removing the systemd service..." -ynh_systemd_action --service_name="$app-beat" --action="stop" --log_path="systemd" --line_match="Stopped $app" -ynh_systemd_action --service_name="$app-server" --action="stop" --log_path="systemd" --line_match="Stopped $app" -ynh_systemd_action --service_name="$app-worker" --action="stop" --log_path="systemd" --line_match="Stopped $app" +ynh_systemctl --service="$app-beat" --action="stop" --log_path="systemd" --wait_until="Stopped $app" +ynh_systemctl --service="$app-server" --action="stop" --log_path="systemd" --wait_until="Stopped $app" +ynh_systemctl --service="$app-worker" --action="stop" --log_path="systemd" --wait_until="Stopped $app" # Remove the dedicated systemd config -ynh_remove_systemd_config --service="$app-beat" -ynh_remove_systemd_config --service="$app-server" -ynh_remove_systemd_config --service="$app-worker" +ynh_config_remove_systemd"$app-beat" +ynh_config_remove_systemd"$app-server" +ynh_config_remove_systemd"$app-worker" -ynh_secure_remove --file="/etc/systemd/system/$app.target" +ynh_safe_rm "/etc/systemd/system/$app.target" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 +ynh_script_progression "Removing NGINX web server configuration..." # Remove the dedicated NGINX config -ynh_remove_nginx_config +ynh_config_remove_nginx #================================================= # REMOVE LOGS #================================================= -ynh_script_progression --message="Removing logs..." --weight=5 +ynh_script_progression "Removing logs..." -ynh_remove_logrotate +ynh_config_remove_logrotate #================================================= # 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 f354e6c..d4e3b12 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,53 +1,46 @@ #!/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 -db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_name=$(ynh_app_setting_get --key=db_name) #================================================= # STANDARD RESTORATION STEPS #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 +ynh_script_progression "Restoring the NGINX web server configuration..." -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 +ynh_script_progression "Restoring the PostgreSQL database..." -ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name +ynh_psql_db_shell < "./db.sql"" #================================================= # 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" - -chmod 750 "$install_dir" -chmod -R o-rwx "$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 | chmod 750 "$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 | chmod -R o-rwx "$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 SYSTEMD #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 +ynh_script_progression "Restoring $app's systemd service..." -ynh_restore_file --origin_path="/etc/systemd/system/bookwyrm-beat.service" -ynh_restore_file --origin_path="/etc/systemd/system/bookwyrm-server.service" -ynh_restore_file --origin_path="/etc/systemd/system/bookwyrm-worker.service" -ynh_restore_file --origin_path="/etc/systemd/system/bookwyrm.target" +ynh_restore "/etc/systemd/system/bookwyrm-beat.service" +ynh_restore "/etc/systemd/system/bookwyrm-server.service" +ynh_restore "/etc/systemd/system/bookwyrm-worker.service" +ynh_restore "/etc/systemd/system/bookwyrm.target" systemctl enable "bookwyrm-beat.service" --quiet systemctl enable "bookwyrm-server.service" --quiet @@ -56,7 +49,7 @@ systemctl enable "bookwyrm-worker.service" --quiet #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression "Integrating service in YunoHost..." yunohost service add "$app-beat" --log="/var/log/$app/$app-beat.log" yunohost service add "$app-server" --log="/var/log/$app/$app.log" @@ -65,23 +58,21 @@ yunohost service add "$app-worker" --log="/var/log/$app/$app-worker.log" #================================================= # 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-beat" --action="start" --log_path="systemd" --line_match="Started bookwyrm celery beat process" -ynh_systemd_action --service_name="$app-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" -ynh_systemd_action --service_name="$app-worker" --action="start" --log_path="systemd" --line_match="ready" +ynh_systemctl --service="$app-beat" --action="start" --log_path="systemd" --wait_until="Started bookwyrm celery beat process" +ynh_systemctl --service="$app-server" --action="start" --log_path="systemd" --wait_until="Booting worker with pid" +ynh_systemctl --service="$app-worker" --action="start" --log_path="systemd" --wait_until="ready" -#================================================= -# 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 1431540..d02beee 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -14,60 +8,52 @@ source /usr/share/yunohost/helpers #================================================= # uncomment me after some updates whenever the key variable is set in install for some times -#key=$(ynh_app_setting_get --app=$app --key=key --value=$key) +#key=$(ynh_app_setting_get --key=key --value=$key) #remove me when key setting is uncommented (see above) key=$(ynh_string_random --length=32) -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - -#================================================= -# 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 --action="stop" --service_name="bookwyrm-beat" --log_path="systemd" -ynh_systemd_action --action="stop" --service_name="bookwyrm-server" --log_path="systemd" -ynh_systemd_action --action="stop" --service_name="bookwyrm-worker" --log_path="systemd" +ynh_systemctl --action="stop" --service="bookwyrm-beat" --log_path="systemd" +ynh_systemctl --action="stop" --service="bookwyrm-server" --log_path="systemd" +ynh_systemctl --action="stop" --service="bookwyrm-worker" --log_path="systemd" #================================================= # 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 app.src - ynh_setup_source --dest_dir="$install_dir" --source_id="main" --full_replace=1 --keep=".env" - ynh_setup_source --dest_dir="$install_dir/static/fonts/source_han_sans" --source_id="fonts" --full_replace=1 + ynh_setup_source --dest_dir="$install_dir" --source_id="main" --full_replace --keep=".env" + ynh_setup_source --dest_dir="$install_dir/static/fonts/source_han_sans" --source_id="fonts" --full_replace fi -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -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 | chmod 750 "$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 | chmod -R o-rwx "$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" #================================================= # CONFIGURE THE INSTALL SCRIPT #================================================= -ynh_script_progression --message="Upgrading .env file..." --weight=1 +ynh_script_progression "Upgrading .env file..." -ynh_add_config --template="../conf/.env.production" --destination="$install_dir/.env" -chmod 600 $install_dir/.env -chown $app: "$install_dir/.env" +ynh_config_add --template=".env.production" --destination="$install_dir/.env" +#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 600 $install_dir/.env +#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: "$install_dir/.env" #================================================= # CONFIGURE THEN INSTALL SCRIPT AND DEPENDENCIES #================================================= -ynh_script_progression --message="Installing service script..." --weight=1 +ynh_script_progression "Installing service script..." -ynh_secure_remove --file="$install_dir/venv" +ynh_safe_rm "$install_dir/venv" mkdir "$install_dir/venv" python3 -m venv "$install_dir/venv" $install_dir/venv/bin/pip3 install -r "$install_dir/requirements.txt" @@ -75,7 +61,7 @@ $install_dir/venv/bin/pip3 install -r "$install_dir/requirements.txt" #================================================= # Update DATABASE #================================================= -ynh_script_progression --message="Upgrading database..." --weight=1 +ynh_script_progression "Upgrading database..." pushd $install_dir $install_dir/venv/bin/python3 "$install_dir/manage.py" compile_themes @@ -88,34 +74,31 @@ popd # SET PERMISSIONS ON BOOKWYRM DIRECTORY #================================================= -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 #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression "Upgrading NGINX web server configuration..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 +ynh_script_progression "Upgrading systemd configuration..." -ynh_add_config --template="../conf/bookwyrm.target" --destination="/etc/systemd/system/$app.target" +ynh_config_add --template="bookwyrm.target" --destination="/etc/systemd/system/$app.target" # Create a dedicated systemd config -ynh_add_systemd_config --service="$app-server" --template="bookwyrm-server.service" -ynh_add_systemd_config --service="$app-worker" --template="bookwyrm-worker.service" -ynh_add_systemd_config --service="$app-beat" --template="bookwyrm-beat.service" +ynh_config_add_systemd --service="$app-server" --template="bookwyrm-server.service" +ynh_config_add_systemd --service="$app-worker" --template="bookwyrm-worker.service" +ynh_config_add_systemd --service="$app-beat" --template="bookwyrm-beat.service" -#================================================= -# GENERIC FINALIZATION #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression "Integrating service in YunoHost..." yunohost service add "$app-beat" --log="/var/log/$app/$app-beat.log" yunohost service add "$app-server" --log="/var/log/$app/$app.log" @@ -124,14 +107,14 @@ yunohost service add "$app-worker" --log="/var/log/$app/$app-worker.log" #================================================= # 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-beat" --action="start" --log_path="systemd" --line_match="Started bookwyrm celery beat process" -ynh_systemd_action --service_name="$app-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" -ynh_systemd_action --service_name="$app-worker" --action="start" --log_path="systemd" --line_match="ready" +ynh_systemctl --service="$app-beat" --action="start" --log_path="systemd" --wait_until="Started bookwyrm celery beat process" +ynh_systemctl --service="$app-server" --action="start" --log_path="systemd" --wait_until="Booting worker with pid" +ynh_systemctl --service="$app-worker" --action="start" --log_path="systemd" --wait_until="ready" #================================================= # 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]