mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Allow to disable the backup during the upgrade
This commit is contained in:
parent
61a60d0f5c
commit
ebdc67e02f
1 changed files with 41 additions and 29 deletions
|
@ -37,7 +37,10 @@ ynh_get_plain_key() {
|
||||||
ynh_restore_upgradebackup () {
|
ynh_restore_upgradebackup () {
|
||||||
echo "Upgrade failed." >&2
|
echo "Upgrade failed." >&2
|
||||||
local app_bck=${app//_/-} # Replace all '_' by '-'
|
local app_bck=${app//_/-} # Replace all '_' by '-'
|
||||||
|
NO_BACKUP_UPGRADE=${NO_BACKUP_UPGRADE:-0}
|
||||||
|
|
||||||
|
if [ "$NO_BACKUP_UPGRADE" -eq 0 ]
|
||||||
|
then
|
||||||
# Check if an existing backup can be found before removing and restoring the application.
|
# Check if an existing backup can be found before removing and restoring the application.
|
||||||
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade$backup_number
|
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade$backup_number
|
||||||
then
|
then
|
||||||
|
@ -47,6 +50,9 @@ ynh_restore_upgradebackup () {
|
||||||
sudo yunohost backup restore --ignore-system $app_bck-pre-upgrade$backup_number --apps $app --force
|
sudo yunohost backup restore --ignore-system $app_bck-pre-upgrade$backup_number --apps $app --force
|
||||||
ynh_die "The app was restored to the way it was before the failed upgrade."
|
ynh_die "The app was restored to the way it was before the failed upgrade."
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "\$NO_BACKUP_UPGRADE is set, that means there's no backup to restore. You have to fix this upgrade by yourself !" >&2
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make a backup in case of failed upgrade
|
# Make a backup in case of failed upgrade
|
||||||
|
@ -67,7 +73,10 @@ ynh_backup_before_upgrade () {
|
||||||
backup_number=1
|
backup_number=1
|
||||||
local old_backup_number=2
|
local old_backup_number=2
|
||||||
local app_bck=${app//_/-} # Replace all '_' by '-'
|
local app_bck=${app//_/-} # Replace all '_' by '-'
|
||||||
|
NO_BACKUP_UPGRADE=${NO_BACKUP_UPGRADE:-0}
|
||||||
|
|
||||||
|
if [ "$NO_BACKUP_UPGRADE" -eq 0 ]
|
||||||
|
then
|
||||||
# Check if a backup already exists with the prefix 1
|
# Check if a backup already exists with the prefix 1
|
||||||
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade1
|
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade1
|
||||||
then
|
then
|
||||||
|
@ -89,6 +98,9 @@ ynh_backup_before_upgrade () {
|
||||||
else
|
else
|
||||||
ynh_die "Backup failed, the upgrade process was aborted."
|
ynh_die "Backup failed, the upgrade process was aborted."
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "\$NO_BACKUP_UPGRADE is set, backup will be avoided. Be careful, this upgrade is going to be operated without securi$
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
|
Loading…
Add table
Reference in a new issue