2022-11-23 10:08:54 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
|
|
#=================================================
|
2024-08-31 02:59:28 +02:00
|
|
|
ynh_script_progression "Ensuring downward compatibility..."
|
2022-11-23 10:08:54 +01:00
|
|
|
|
2023-09-18 20:10:21 +02:00
|
|
|
if [ -e "$install_dir/searx" ]; then
|
2023-09-27 22:08:09 +02:00
|
|
|
tempdir="$(mktemp -d)"
|
|
|
|
mv "$install_dir/searx/settings.yml" "$tempdir/settings.yml"
|
|
|
|
sed -i '1s/^/use_default_settings: true\n\n/' "$tempdir/settings.yml"
|
2024-08-31 02:59:28 +02:00
|
|
|
ynh_safe_rm "$install_dir"
|
2023-09-27 22:08:09 +02:00
|
|
|
mkdir "$install_dir"
|
|
|
|
mv "$tempdir/settings.yml" "$install_dir/settings.yml"
|
2024-08-31 02:59:28 +02:00
|
|
|
ynh_safe_rm "$tempdir"
|
|
|
|
ynh_store_file_checksum "$install_dir/settings.yml"
|
|
|
|
ynh_delete_file_checksum "/opt/yunohost/$app/searx/settings.yml"
|
2022-11-23 10:08:54 +01:00
|
|
|
fi
|
|
|
|
|
2024-08-31 02:59:28 +02:00
|
|
|
ynh_delete_file_checksum "etc/nginx_conf.d/$domain/$app.conf"
|
|
|
|
|
2022-11-23 10:08:54 +01:00
|
|
|
#=================================================
|
2023-09-18 18:10:55 +02:00
|
|
|
# STOP SYSTEMD SERVICE
|
2022-11-23 10:08:54 +01:00
|
|
|
#=================================================
|
2024-08-31 02:59:28 +02:00
|
|
|
ynh_script_progression "Stopping $app's systemd service..."
|
2022-11-23 10:08:54 +01:00
|
|
|
|
2024-08-31 02:59:28 +02:00
|
|
|
ynh_systemctl --service="uwsgi-app@$app.service" --action="stop" --log_path="/var/log/uwsgi/$app/$app.log"
|
2022-11-23 10:08:54 +01:00
|
|
|
|
2023-09-18 18:10:55 +02:00
|
|
|
#=================================================
|
|
|
|
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
|
2022-11-23 10:08:54 +01:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
|
|
|
|
2024-08-31 02:59:28 +02:00
|
|
|
# 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
|
2022-11-23 10:08:54 +01:00
|
|
|
then
|
2024-08-31 02:59:28 +02:00
|
|
|
ynh_safe_rm "$install_dir/.profile"
|
|
|
|
ynh_safe_rm "$install_dir/.cache"
|
|
|
|
ynh_safe_rm "$install_dir/searxng-src"
|
|
|
|
ynh_safe_rm "$install_dir/searxng-pyenv"
|
2024-07-22 16:17:56 +02:00
|
|
|
myynh_source_searxng
|
|
|
|
myynh_install_searxng
|
2022-11-23 10:08:54 +01:00
|
|
|
fi
|
|
|
|
|
2024-07-22 16:17:56 +02:00
|
|
|
myynh_set_permissions
|
2022-11-23 10:08:54 +01:00
|
|
|
|
|
|
|
#=================================================
|
2023-09-18 18:10:55 +02:00
|
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
2022-11-23 10:08:54 +01:00
|
|
|
#=================================================
|
2024-08-31 02:59:28 +02:00
|
|
|
ynh_script_progression "Upgrading system configurations related to $app..."
|
2022-11-23 10:08:54 +01:00
|
|
|
|
2024-08-31 02:59:28 +02:00
|
|
|
ynh_config_add_nginx
|
2022-11-23 10:08:54 +01:00
|
|
|
|
|
|
|
#=================================================
|
2023-09-18 18:10:55 +02:00
|
|
|
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
|
2022-11-23 10:08:54 +01:00
|
|
|
#=================================================
|
2023-09-18 18:10:55 +02:00
|
|
|
# UPDATE A CONFIG FILE
|
2022-11-23 10:08:54 +01:00
|
|
|
#=================================================
|
2024-08-31 02:59:28 +02:00
|
|
|
ynh_script_progression "Updating configuration..."
|
2022-11-23 10:08:54 +01:00
|
|
|
|
2023-03-01 19:36:12 +01:00
|
|
|
ynh_add_uwsgi_service
|
2022-11-23 10:08:54 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2024-08-31 02:59:28 +02:00
|
|
|
ynh_script_progression "Starting $app's systemd service..."
|
|
|
|
|
|
|
|
ynh_systemctl --service="uwsgi-app@$app.service" --action="start" --wait_until="spawned uWSGI master process" --log_path="/var/log/uwsgi/$app/$app.log"
|
2022-11-23 10:08:54 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2024-08-31 02:59:28 +02:00
|
|
|
ynh_script_progression "Upgrade of $app completed"
|