1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/codimd_ynh.git synced 2024-09-03 18:16:32 +02:00
codimd_ynh/scripts/restore
eric_G 1c4461e674
Testing (#87)
* cleaning (#77)

* Update upgrade

* 2.4.2 (#79)

* 2.4.2

* Auto-update README

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* [autopatch] Add Common Platform Enumeration id to `manifest.json` (#81)

* Testing (#80)

* cleaning (#77)

* Update upgrade

* 2.4.2 (#79)

* 2.4.2

* Auto-update README

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* [autopatch] Add Common Platform Enumeration id to `manifest.json`

Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: Yunohost-Bot <>

* set relative path for --keep opt

* Auto-update README

* Update install

* Auto-update README

* Upgrade auto-updater (#84)

* [autopatch] Upgrade auto-updater

* Auto-update README

---------

Co-authored-by: tituspijean <titus@pijean.ovh>

* Update manifest.json

* v2 (#85)

* v2

* v2

* Auto-update README

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Update manifest.toml

* Auto-update README

* Update manifest.toml

* Update manifest.toml

* Update manifest.toml

* Auto-update README

* Update _common.sh

* cleaning

* Auto-update README

* Update _common.sh

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: YunoHost Bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: tituspijean <titus@pijean.ovh>
2023-12-24 18:20:53 +01:00

63 lines
2.3 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
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=60
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=7
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
yunohost service add $app --description="Collaborative Markdown notes" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening"
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last