1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/weblate_ynh.git synced 2024-10-01 13:35:04 +02:00
weblate_ynh/scripts/restore

102 lines
3.4 KiB
Text
Raw Normal View History

#!/bin/bash
2019-03-10 08:20:59 +01:00
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
2022-03-04 08:23:50 +01:00
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression "Restoring the app main directory..."
ynh_restore "$install_dir"
2022-03-04 08:23:50 +01:00
2024-01-17 14:07:41 +01:00
touch "$install_dir/local_settings.py"
ln -sf "$install_dir/local_settings.py" "$install_dir/venv/lib/$weblate_pypath/site-packages/weblate/local_settings.py"
2021-05-04 21:12:52 +02:00
2024-09-18 20:34:28 +02:00
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app: "$install_dir"
chown $app:www-data "$install_dir"
2024-01-17 14:07:41 +01:00
chown -R $app:www-data "$install_dir/data"
2020-10-28 12:02:15 +01:00
2017-09-22 09:05:28 +02:00
#=================================================
2022-07-13 00:48:56 +02:00
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression "Restoring the NGINX web server configuration..."
2022-07-13 00:48:56 +02:00
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
2022-07-13 00:48:56 +02:00
#=================================================
# RESTORE THE POSTGRESQL DATABASE
2017-09-22 09:05:28 +02:00
#=================================================
ynh_script_progression "Restoring the PostgreSQL database..."
2017-09-22 09:05:28 +02:00
ynh_psql_db_shell < ./db.sql
2017-09-14 14:35:53 +02:00
2022-07-13 02:11:01 +02:00
#=================================================
# INSTALL XXHASH
#=================================================
ynh_script_progression "Installing xxHash..."
2022-07-13 02:11:01 +02:00
tempdir="$(mktemp -d)"
ynh_setup_source --dest_dir=$tempdir --source_id="libxxhash"
pushd $tempdir
make
make install
popd
ynh_safe_rm "$tempdir"
2022-07-13 02:11:01 +02:00
2022-03-04 08:23:50 +01:00
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression "Restoring various files..."
2022-03-04 08:23:50 +01:00
ynh_restore "/etc/uwsgi/apps-available/$app.ini"
2022-03-04 08:23:50 +01:00
2017-11-21 15:31:11 +01:00
#=================================================
2020-10-28 12:02:15 +01:00
# RESTORE SYSTEMD
2017-11-21 15:31:11 +01:00
#=================================================
ynh_script_progression "Restoring $app's systemd service..."
2017-11-21 15:31:11 +01:00
ynh_restore "/etc/systemd/system/$app.service"
2020-12-13 18:47:45 +01:00
systemctl enable $app.service --quiet
ynh_restore "/etc/systemd/system/$app-celery.service"
2020-12-13 18:47:45 +01:00
systemctl enable "$app-celery" --quiet
2019-03-10 21:57:52 +01:00
#=================================================
2022-03-04 08:23:50 +01:00
# RESTORE THE LOGROTATE CONFIGURATION
2019-03-10 21:57:52 +01:00
#=================================================
ynh_script_progression "Restoring the logrotate configuration..."
2019-03-10 21:57:52 +01:00
2022-03-04 08:23:50 +01:00
mkdir -p "/var/log/$app"
ynh_restore "/etc/logrotate.d/$app"
2018-10-25 08:01:46 +02:00
#=================================================
2020-10-28 12:02:15 +01:00
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression "Integrating service in YunoHost..."
2022-03-04 08:23:50 +01:00
yunohost service add $app --log="/var/log/$app/weblate.log"
2024-01-19 14:30:13 +01:00
yunohost service add "$app-celery" --log="/var/log/$app/weblate-celery-w1.log"
2019-08-23 08:32:02 +02:00
#=================================================
2022-03-04 08:23:50 +01:00
# START SYSTEMD SERVICE
2019-08-23 08:32:02 +02:00
#=================================================
ynh_script_progression "Starting $app's systemd service..."
2019-08-23 08:32:02 +02:00
ynh_systemctl --service=$app --action="start" --log_path="/var/log/$app/weblate.log" --wait_until="spawned uWSGI"
ynh_systemctl --service="$app-celery" --action="start" --log_path="/var/log/$app/weblate-celery-w1.log" --wait_until="mingle: all alone"
2019-08-23 08:32:02 +02:00
#=================================================
2019-05-30 20:51:22 +02:00
# RELOAD NGINX
#=================================================
ynh_script_progression "Reloading NGINX web server..."
ynh_systemctl --service=nginx --action=reload
2019-05-30 20:51:22 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2022-03-04 08:23:50 +01:00
ynh_script_progression "Restoration completed for $app"