openhab / openhab-linuxpkg

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

Copy over REPLACE function from update script #148

Closed BClark09 closed 4 years ago

BClark09 commented 4 years ago

Signed-off-by: Ben Clark ben@benjyc.uk

wborn commented 4 years ago

Maybe it's possible to refactor the Linux update script in openhab-distro so the logic can be more easily reused?

I.e. there could be one file providing reusable update functions and another one could use these functions to update a manual installation. Then we can more easily reuse these update functions in other repos (linuxpkg, synology, snap, docker).

BClark09 commented 4 years ago

Hi @wborn, absolutely. If we make a parameter check for something like changesonly * in the update script we can call on those functions, this way we could use our own update functions and call e.g.

${OPENHAB_RUNTIME}/bin/update changeonly PRE
[instalation update specifics]
${OPENHAB_RUNTIME}/bin/update changesonly POST

Is that what you had in mind?

wborn commented 4 years ago

Yes something like that would help.

I tried using the update script from openhab-distro in the Docker container and got it working. But I found out it's only for manual installations because it always downloads a new distro and always replaces the runtime dir which are already part of the container. So that's a lot of unnecessary downloading and copying when using containers. :wink:

So I thought let's have a look at how the Linux packages do this and found out it uses the postinst script instead of the update script.

It's probably best to use a similar approach in the Docker containers so it uses a modified version of the update script using the update.lst, userdata_sysfiles.lst as input.

BClark09 commented 4 years ago

Tested the above change and will merge so that Linuxpkg is ready for a new milestone build.

I will try to get round to modifying the update script in the distro when I next have time :)