mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
101 lines
3.4 KiB
Bash
Executable file
101 lines
3.4 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
source ../settings/scripts/_common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RESTORE THE APP MAIN DIR
|
|
#=================================================
|
|
ynh_script_progression "Restoring the app main directory..."
|
|
|
|
ynh_restore "$install_dir"
|
|
|
|
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"
|
|
|
|
chmod 750 "$install_dir"
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app: "$install_dir"
|
|
chown $app:www-data "$install_dir"
|
|
chown -R $app:www-data "$install_dir/data"
|
|
|
|
#=================================================
|
|
# RESTORE THE NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression "Restoring the NGINX web server configuration..."
|
|
|
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
#=================================================
|
|
# RESTORE THE POSTGRESQL DATABASE
|
|
#=================================================
|
|
ynh_script_progression "Restoring the PostgreSQL database..."
|
|
|
|
ynh_psql_db_shell < ./db.sql
|
|
|
|
#=================================================
|
|
# INSTALL XXHASH
|
|
#=================================================
|
|
ynh_script_progression "Installing xxHash..."
|
|
|
|
tempdir="$(mktemp -d)"
|
|
ynh_setup_source --dest_dir=$tempdir --source_id="libxxhash"
|
|
pushd $tempdir
|
|
make
|
|
make install
|
|
popd
|
|
ynh_safe_rm "$tempdir"
|
|
|
|
#=================================================
|
|
# RESTORE VARIOUS FILES
|
|
#=================================================
|
|
ynh_script_progression "Restoring various files..."
|
|
|
|
ynh_restore "/etc/uwsgi/apps-available/$app.ini"
|
|
|
|
#=================================================
|
|
# RESTORE SYSTEMD
|
|
#=================================================
|
|
ynh_script_progression "Restoring $app's systemd service..."
|
|
|
|
ynh_restore "/etc/systemd/system/$app.service"
|
|
systemctl enable $app.service --quiet
|
|
ynh_restore "/etc/systemd/system/$app-celery.service"
|
|
systemctl enable "$app-celery" --quiet
|
|
|
|
#=================================================
|
|
# RESTORE THE LOGROTATE CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression "Restoring the logrotate configuration..."
|
|
|
|
mkdir -p "/var/log/$app"
|
|
ynh_restore "/etc/logrotate.d/$app"
|
|
|
|
#=================================================
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
|
#=================================================
|
|
ynh_script_progression "Integrating service in YunoHost..."
|
|
|
|
yunohost service add $app --log="/var/log/$app/weblate.log"
|
|
yunohost service add "$app-celery" --log="/var/log/$app/weblate-celery-w1.log"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression "Starting $app's systemd service..."
|
|
|
|
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"
|
|
|
|
#=================================================
|
|
# RELOAD NGINX
|
|
#=================================================
|
|
ynh_script_progression "Reloading NGINX web server..."
|
|
|
|
ynh_systemctl --service=nginx --action=reload
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression "Restoration completed for $app"
|