1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/petrolette_ynh.git synced 2024-09-03 19:56:26 +02:00

change backup script

This commit is contained in:
Tobias Ollive 2021-04-07 11:07:59 +02:00
parent c5691b7bab
commit f4e49412fc
4 changed files with 25 additions and 39 deletions

View file

@ -8,7 +8,7 @@
is_public=1 (PUBLIC|public=1|private=0) is_public=1 (PUBLIC|public=1|private=0)
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=0
setup_root=1 setup_root=1
setup_nourl=0 setup_nourl=0
setup_private=1 setup_private=1

View file

@ -14,7 +14,7 @@
"email": "tobias.ollive@oiseauroch.fr" "email": "tobias.ollive@oiseauroch.fr"
}], }],
"requirements": { "requirements": {
"yunohost": ">= 4.0.0" "yunohost": ">= 4.1.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -25,30 +25,16 @@
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": {
"en": "Choose a domain for Petrolette",
"fr": "Choisissez un domaine pour Petrolette"
},
"example": "domain.org" "example": "domain.org"
}, },
{
"name": "path",
"type": "path",
"ask": {
"en": "choose a path",
"fr": "Choisissez un chemin"
},
"example": "petrolette",
"default": "/"
},
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"ask": { "default": true,
"en": "Is it a public application?", "help" : {
"fr": "Cette application doit-elle être publique ?" "fr" : "Cette page sera accessible par n'importe qui. En revanche, la configuration reste personnelle"
}, "en" : "The page will be accessible by anyone."
"default": true }
} }
] ]
} }

View file

@ -37,12 +37,6 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#================================================= #=================================================
ynh_print_info --message="Declaring files to be backed up..." ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================

View file

@ -52,12 +52,27 @@ test ! -d $final_path \
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE MAINDIR # SPECIFIC RESTORATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=5 # REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
#=================================================
# REINSTALL PETROLLETTE
#=================================================
ynh_script_progression --message="Reinstalling the app ..." --weight=5
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
pushd $final_path
ynh_use_nodejs
ynh_npm install
popd
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
@ -74,15 +89,6 @@ ynh_system_user_create --username=$app
chown -R $app:$app $final_path chown -R $app:$app $final_path
chmod -R o-rwx $final_path chmod -R o-rwx $final_path
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================