1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pixelfed_ynh.git synced 2024-09-03 20:06:04 +02:00
pixelfed_ynh/scripts/restore
lapineige c0e39f528f
Testing : fix emails (#232)
* v2

* v2

* Create tests.toml

* Auto-update README

* fix

* Update _common.sh

* Update install

* Update manifest.toml

* Update manifest.toml

* cleaning

* Auto-update README

* Auto-update README

* Add post edits (from dev branch)

Using lastest commit as most of the previous ones fix edits stuff + bugs
5cfe8cd56a

* bump version

* Auto-update README

* cleaning

* Update manifest.toml

* Auto-update README

* Update ADMIN.md

* Update change_url

* php8.2

* php8.2

* add ressources needed

* php8.2

* update PHP

* post edit formatting fixes

4479055e1e

* v0.11.8

* v0.11.8

* Auto-update README

* Master -> ynh V2 (v0.11.8)

* Auto-update README

* Update .env

* Fix .env + improvements

https://github.com/YunoHost-Apps/pixelfed_ynh/pull/219#issuecomment-1568049256

* Update manifest.toml

* Auto-update README

* Typo

* Patch file access right (fix post 0.11.5 installs)

* Bump version (post v0.11.5 install fixes)

* Auto-update README

* Update extra_php-fpm.conf

Fix #223

* Testing : fix ≥0.11.5 installs (#222) (#225)

* v2

* v2

* Create tests.toml

* Auto-update README

* fix

* Update _common.sh

* Update install

* Update manifest.toml

* Update manifest.toml

* cleaning

* Auto-update README

* Auto-update README

* Add post edits (from dev branch)

Using lastest commit as most of the previous ones fix edits stuff + bugs
5cfe8cd56a

* bump version

* Auto-update README

* cleaning

* Update manifest.toml

* Auto-update README

* Update ADMIN.md

* Update change_url

* php8.2

* php8.2

* add ressources needed

* php8.2

* update PHP

* post edit formatting fixes

4479055e1e

* v0.11.8

* v0.11.8

* Auto-update README

* Master -> ynh V2 (v0.11.8)

* Auto-update README

* Update .env

* Fix .env + improvements

https://github.com/YunoHost-Apps/pixelfed_ynh/pull/219#issuecomment-1568049256

* Update manifest.toml

* Auto-update README

* Typo

* Patch file access right (fix post 0.11.5 installs)

* Bump version (post v0.11.5 install fixes)

* Auto-update README

---------

Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: ericgaspar <junk.eg@free.fr>

* Bump version

* Auto-update README

* Fix post-v2 issues

* Patch post v0.11.5 permissions

Why are they not correct by default ?

* Testing : fix images rights in package v2 (#224) (#227)

* v2

* v2

* Create tests.toml

* Auto-update README

* fix

* Update _common.sh

* Update install

* Update manifest.toml

* Update manifest.toml

* cleaning

* Auto-update README

* Auto-update README

* Add post edits (from dev branch)

Using lastest commit as most of the previous ones fix edits stuff + bugs
5cfe8cd56a

* bump version

* Auto-update README

* cleaning

* Update manifest.toml

* Auto-update README

* Update ADMIN.md

* Update change_url

* php8.2

* php8.2

* add ressources needed

* php8.2

* update PHP

* post edit formatting fixes

4479055e1e

* v0.11.8

* v0.11.8

* Auto-update README

* Master -> ynh V2 (v0.11.8)

* Auto-update README

* Update .env

* Fix .env + improvements

https://github.com/YunoHost-Apps/pixelfed_ynh/pull/219#issuecomment-1568049256

* Update manifest.toml

* Auto-update README

* Typo

* Patch file access right (fix post 0.11.5 installs)

* Bump version (post v0.11.5 install fixes)

* Auto-update README

* Update extra_php-fpm.conf

Fix #223

* Testing : fix ≥0.11.5 installs (#222) (#225)

* v2

* v2

* Create tests.toml

* Auto-update README

* fix

* Update _common.sh

* Update install

* Update manifest.toml

* Update manifest.toml

* cleaning

* Auto-update README

* Auto-update README

* Add post edits (from dev branch)

Using lastest commit as most of the previous ones fix edits stuff + bugs
5cfe8cd56a

* bump version

* Auto-update README

* cleaning

* Update manifest.toml

* Auto-update README

* Update ADMIN.md

* Update change_url

* php8.2

* php8.2

* add ressources needed

* php8.2

* update PHP

* post edit formatting fixes

4479055e1e

* v0.11.8

* v0.11.8

* Auto-update README

* Master -> ynh V2 (v0.11.8)

* Auto-update README

* Update .env

* Fix .env + improvements

https://github.com/YunoHost-Apps/pixelfed_ynh/pull/219#issuecomment-1568049256

* Update manifest.toml

* Auto-update README

* Typo

* Patch file access right (fix post 0.11.5 installs)

* Bump version (post v0.11.5 install fixes)

* Auto-update README

---------





* Bump version

* Auto-update README

* Fix post-v2 issues

---------

Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: ericgaspar <junk.eg@free.fr>

* Bump version

* Auto-update README

* Fix mail sendmail (#230)

* Testing : patch install permissions (#226)

* v2

* v2

* Create tests.toml

* Auto-update README

* fix

* Update _common.sh

* Update install

* Update manifest.toml

* Update manifest.toml

* cleaning

* Auto-update README

* Auto-update README

* Add post edits (from dev branch)

Using lastest commit as most of the previous ones fix edits stuff + bugs
5cfe8cd56a

* bump version

* Auto-update README

* cleaning

* Update manifest.toml

* Auto-update README

* Update ADMIN.md

* Update change_url

* php8.2

* php8.2

* add ressources needed

* php8.2

* update PHP

* post edit formatting fixes

4479055e1e

* v0.11.8

* v0.11.8

* Auto-update README

* Master -> ynh V2 (v0.11.8)

* Auto-update README

* Update .env

* Fix .env + improvements

https://github.com/YunoHost-Apps/pixelfed_ynh/pull/219#issuecomment-1568049256

* Update manifest.toml

* Auto-update README

* Typo

* Patch file access right (fix post 0.11.5 installs)

* Bump version (post v0.11.5 install fixes)

* Auto-update README

* Update extra_php-fpm.conf

Fix #223

* Testing : fix ≥0.11.5 installs (#222) (#225)

* v2

* v2

* Create tests.toml

* Auto-update README

* fix

* Update _common.sh

* Update install

* Update manifest.toml

* Update manifest.toml

* cleaning

* Auto-update README

* Auto-update README

* Add post edits (from dev branch)

Using lastest commit as most of the previous ones fix edits stuff + bugs
5cfe8cd56a

* bump version

* Auto-update README

* cleaning

* Update manifest.toml

* Auto-update README

* Update ADMIN.md

* Update change_url

* php8.2

* php8.2

* add ressources needed

* php8.2

* update PHP

* post edit formatting fixes

4479055e1e

* v0.11.8

* v0.11.8

* Auto-update README

* Master -> ynh V2 (v0.11.8)

* Auto-update README

* Update .env

* Fix .env + improvements

https://github.com/YunoHost-Apps/pixelfed_ynh/pull/219#issuecomment-1568049256

* Update manifest.toml

* Auto-update README

* Typo

* Patch file access right (fix post 0.11.5 installs)

* Bump version (post v0.11.5 install fixes)

* Auto-update README

---------

Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: ericgaspar <junk.eg@free.fr>

* Bump version

* Auto-update README

* Fix post-v2 issues

* Patch post v0.11.5 permissions

Why are they not correct by default ?

* Testing : fix images rights in package v2 (#224) (#227)

* v2

* v2

* Create tests.toml

* Auto-update README

* fix

* Update _common.sh

* Update install

* Update manifest.toml

* Update manifest.toml

* cleaning

* Auto-update README

* Auto-update README

* Add post edits (from dev branch)

Using lastest commit as most of the previous ones fix edits stuff + bugs
5cfe8cd56a

* bump version

* Auto-update README

* cleaning

* Update manifest.toml

* Auto-update README

* Update ADMIN.md

* Update change_url

* php8.2

* php8.2

* add ressources needed

* php8.2

* update PHP

* post edit formatting fixes

4479055e1e

* v0.11.8

* v0.11.8

* Auto-update README

* Master -> ynh V2 (v0.11.8)

* Auto-update README

* Update .env

* Fix .env + improvements

https://github.com/YunoHost-Apps/pixelfed_ynh/pull/219#issuecomment-1568049256

* Update manifest.toml

* Auto-update README

* Typo

* Patch file access right (fix post 0.11.5 installs)

* Bump version (post v0.11.5 install fixes)

* Auto-update README

* Update extra_php-fpm.conf

Fix #223

* Testing : fix ≥0.11.5 installs (#222) (#225)

* v2

* v2

* Create tests.toml

* Auto-update README

* fix

* Update _common.sh

* Update install

* Update manifest.toml

* Update manifest.toml

* cleaning

* Auto-update README

* Auto-update README

* Add post edits (from dev branch)

Using lastest commit as most of the previous ones fix edits stuff + bugs
5cfe8cd56a

* bump version

* Auto-update README

* cleaning

* Update manifest.toml

* Auto-update README

* Update ADMIN.md

* Update change_url

* php8.2

* php8.2

* add ressources needed

* php8.2

* update PHP

* post edit formatting fixes

4479055e1e

* v0.11.8

* v0.11.8

* Auto-update README

* Master -> ynh V2 (v0.11.8)

* Auto-update README

* Update .env

* Fix .env + improvements

https://github.com/YunoHost-Apps/pixelfed_ynh/pull/219#issuecomment-1568049256

* Update manifest.toml

* Auto-update README

* Typo

* Patch file access right (fix post 0.11.5 installs)

* Bump version (post v0.11.5 install fixes)

* Auto-update README

---------





* Bump version

* Auto-update README

* Fix post-v2 issues

---------

Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: ericgaspar <junk.eg@free.fr>

* Bump version

* Auto-update README

---------

Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: ericgaspar <junk.eg@free.fr>

* Update .env

use sendmail for default mail sending, should work out of the box for fresh installs

* patch source

prevent privilege escalation

* patching source

prevent privilege escalation

* patching source

prevent privilege escalation

* Update manifest.toml

Enable authentication on the mail stack for the system user

* Update .env

authentication on the mail stack with app system user

* Fix old email configs

---------

Co-authored-by: lapineige <lapineige@users.noreply.github.com>
Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: ericgaspar <junk.eg@free.fr>

* remove full_domain

* Add manual email verification doc (#233)

* Add manual email verification doc

* email verification doc (fr)

* fix doc

---------

Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: ericgaspar <junk.eg@free.fr>
Co-authored-by: themancalledjakob <github@jrkb.land>
2023-08-21 18:27:47 +02:00

107 lines
4.3 KiB
Bash

#!/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
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# PATCHING SOURCE
#=================================================
ynh_script_progression --message="Patching source files..." --weight=1
# Prevent privilege escalation by injecting commands in an email name
# This described in more detail on the manpage https://www.postfix.org/sendmail.1.html under security
ynh_replace_string --match_string="'/usr/sbin/sendmail -bs'" --replace_string="'/usr/sbin/sendmail -bs -- '" --target_file=$install_dir/config/mail.php
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..." --weight=1
ynh_restore_file --origin_path="/etc/cron.d/$app"
mkdir -p "/var/log/$app/"
touch "/var/log/$app/${app}-horizon.log"
chown -R $app: "/var/log/$app/"
#=================================================
# RESTORE SUPERVISOR CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the supervisor configuration..." --weight=1
ynh_restore_file --origin_path="/etc/supervisor/conf.d/${app}-horizon.conf"
supervisorctl reread && supervisorctl update
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add "supervisor" --description="Supervisor daemon for $app" --log="/var/log/$app/${app}-horizon.log"
#=================================================
# START SUPERVISOR SERVICE
#=================================================
ynh_script_progression --message="Starting a supervisor service..." --weight=1
ynh_supervisor_action --service_name="${app}-horizon" --action="reload" --log_path="systemd" --line_match="success: ${app}-horizon"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last