1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/plume_ynh.git synced 2024-09-03 20:15:54 +02:00

apply example_ynh to restore

This commit is contained in:
Yalh 2019-01-22 19:51:11 +01:00
parent c84af3a6e6
commit 84e3919816

View file

@ -42,20 +42,6 @@ ynh_webpath_available $domain $path_url \
test ! -d $final_path \
|| ynh_die "There is already a directory: $final_path "
#=================================================
# INSTALL DEPENDENCIES
#=================================================
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
### Those deb packages will be installed as dependencies of this package.
### If you're not using this helper:
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
ynh_install_app_dependencies gettext postgresql postgresql-contrib libpq-dev git curl gcc make openssl libssl-dev pkg-config sqlite3 libsqlite3-dev
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
@ -71,17 +57,7 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file "$final_path"
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
echo "Close port $port" >&2
yunohost firewall disallow TCP $port 2>&1
fi
#=================================================
# RESTORE THE PostgreSQL DATABASE
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_psql_test_if_first_run
@ -96,7 +72,6 @@ ynh_psql_execute_file_as_root ./db.sql "$db_name"
# Create the dedicated user (if not existing)
ynh_system_user_create $app "$final_path"
#=================================================
# RESTORE USER RIGHTS
#=================================================
@ -104,6 +79,27 @@ ynh_system_user_create $app "$final_path"
# Restore permissions on app files
chown -R $app: $final_path
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
#ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
# Define and install dependencies
ynh_install_app_dependencies gettext postgresql postgresql-contrib libpq-dev git curl gcc make openssl libssl-dev pkg-config sqlite3 libsqlite3-dev
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
#yunohost service add $app --log "/var/log/$app/APP.log"
#=================================================
# RESTORE SYSTEMD
#=================================================
@ -111,6 +107,12 @@ chown -R $app: $final_path
ynh_restore_file "/etc/systemd/system/$app.service"
systemctl enable $app.service
#=================================================
# RESTORE THE CRON FILE
#=================================================
#ynh_restore_file "/etc/cron.d/$app"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
@ -128,3 +130,4 @@ systemctl enable "$app"
systemctl start "$app"
# App needs time to start
sleep 10