1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cac-proxy_ynh.git synced 2024-09-03 18:16:07 +02:00

Better fix by creating expected file

This commit is contained in:
Gérard Collin 2023-09-28 11:28:10 +02:00
parent 4b0c0c1745
commit cf01d3f9ab

View file

@ -38,18 +38,25 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
# There is an issue in previous backup file in case of non public_key, so backup only in case of public_key # There is an issue in previous backup file in case of non public_key, so we create the missing directory
if [ -n "$public_key" ] if [ ! -f "/etc/sudoers.d/$app-sudoers" ]
then then
touch "/etc/sudoers.d/$app-sudoers"
fi
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
# Restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
# Removes the directory created only for backup if not necessary
if [ ! -n "$public_key" ]
then
rm "/etc/sudoers.d/$app-sudoers"
fi fi
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script