openhab / openhab-distro

The binary distribution of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.3k stars 394 forks source link

Backups should record userdata and runtime location #1145

Open BClark09 opened 3 years ago

BClark09 commented 3 years ago

The runtime creates a few files that have hardcoded paths in $OPENHAB_USERDATA. If these are backed up on one machine and restored on another then these paths may be incorrect.

If we can't change these to paths to references, we should store the paths in the backup folder so that the restore scripts can do a find and replace to the new path on those hardcoded files.

On Linux/Mac OS, I assume that the restore commands would looks similar to:

find ${OPENHAB_USERDATA}/config/ -type f -name "*.config" -exec sed -i'.bak' "s|${OLD_USERDATA}/|${OPENHAB_USERDATA}/|g" {} \;
find ${OPENHAB_USERDATA}/config/ -type f -name "*.config" -exec sed -i'.bak' "s|${OLD_RUNTIME}/|${OPENHAB_RUNTIME}/|g" {} \;

This needed to be done (https://github.com/openhab/openhab-linuxpkg/pull/181#issuecomment-685750453) when the linuxpkg file paths moved from **/openhab2/ to **/openhab/:

I will try to get a PR through if I get the time but don't think I'll be able to do something about the Windows script.

wborn commented 3 years ago

I'm here to comment that this also relates to https://github.com/openhab/openhab-distro/issues/860. :wink: