1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/helloworld_ynh.git synced 2024-09-03 19:15:57 +02:00

Merge pull request #6 from YunoHost-Apps/testing

Test upgrade from packaging v1
This commit is contained in:
Alexandre Aubin 2023-03-14 00:36:59 +01:00 committed by GitHub
commit c1a1c035f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 105 additions and 2 deletions

13
LICENSE Normal file
View file

@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2023 YunoHost
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

32
scripts/backup Normal file
View file

@ -0,0 +1,32 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

40
scripts/restore Normal file
View file

@ -0,0 +1,40 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
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"
# Restore permissions on app files
chown -R $app:www-data $install_dir
chmod -R o-rwx $install_dir
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last

19
scripts/upgrade Normal file
View file

@ -0,0 +1,19 @@
#!/bin/bash
source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
echo "Hello world!" > $install_dir/index.html
chown -R www-data: "$install_dir"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring nginx web server..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config

View file

@ -33,8 +33,7 @@ test_format = 1.0
# Commits to test upgrade from
# -------------------------------
# test_upgrade_from.00a1a6e7.name = "Upgrade from 5.4"
# test_upgrade_from.00a1a6e7.args.foo = "bar"
test_upgrade_from.d8c645bb.name = "Initial commit / packaging v1"
[whatever]