openhab / openhab-linuxpkg

Repo for Linux packages
Eclipse Public License 2.0
18 stars 33 forks source link

Automatically backup the configuration when upgrading via a package manager #230

Open nelsonaponte opened 2 months ago

nelsonaponte commented 2 months ago

When openHAB is managed by a package manager (apt, yum, dnf) and the user attempts to upgrade it via the package manager, the first step of the upgrade process should be to make a full backup of the current configuration (as done by the command openhab-cli backup) and store it under the standard backups folded (/var/lib/openhab/backups/) using the filename specified in https://github.com/openhab/openhab-linuxpkg/issues/228.

After the upgrade is completed (successfully or unsuccessfully), a warning message with the message "Please note that a full backup of the old configuration was taken and stored in /var/lib/openhab/backups/ at the beginning of the upgrade process." should be displayed.

Reason

Many users don't know how to backup files or forget to do it before upgrading to a newer OH version. The upgrade process could take care of that for them.

BClark09 commented 2 months ago

Hi @nelsonaponte, thanks for your issue posts regarding backups!

A full backup (--full) includes a lot of files that would usually be considered unnecessary, this is a good idea for relatively simple setups but might make the installation too large over time for more complex setups. The other side of the scale here is that users might not realize a backup is being made (users might miss such a warning when upgrading using a manager like apt when they upgrade many packages at the same time).

nelsonaponte commented 2 months ago

Hi, @BClark09. Thanks for your response.

Even if users miss the warning, the backup will be there and might save them in the future. At least they will be warned when trying to uninstall OH that the backups were not deleted. We should also communicate it in the documentation.

About the full backup, do you know if there is any option that would suffice? I guess the textual and UI configurations should be backed up, but I don't know what else. I backup using the command openhab-cli backup.

Alternatively, the user could be asked with a prompt when the upgrade process begins if he wants the system to take a full backup or not. I don't know if there are users with any kind of automatic upgrade configuration and this would make it a bit annoying for them, but for most, it should be useful.