Script for replacing runtime modules on docker image

This an init script that I use to test core modifications on the openhab docker image.
This way I just need to move the jars into my userdata/runtime_swap (and remove userdata/tmp and userdata/cache folders) and restart the image.
In case it’s useful for any one else.

for file in $RUNTIME_CUSTOM_JARS; do
  if [ "$RUNTIME_CUSTOM_JARS" = "$file" ]; then
    echo "no runtime to replace"
    exit 0
  runtime_jar=$(find /openhab/runtime/ -path "*/$packagename/*.jar")
  if [ -n "$runtime_jar" ]
      echo "replacing $runtime_jar by $file"
      cp "$file" "$runtime_jar"
      echo "no runtime jar found for file $file"

Per say, you do not need to make clean start after update, in some cases it is sufficient just to update specific core module through update xyz file:abc.jar where xyz is core bundle id and abc.jar is updated version. More importantly, if you do a restart updated bundle should take part in boot process.

Most reliable (also slowest) way is doing a clean start. If you run docker you can do docker cp my.jar openhab-container-id:/path which will allow you doing it without scripts inside docker.

Cheers and good luck!

1 Like

Didn’t know about this. Thank you!

The motivation for me to do it like this is to have an easy way to do this with multiple bundles on a remote server just through FileZilla and Portainer.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.