Whats your way to update OH2 with another nightly build?

Jim,

Thank you for your reply. I will try again tonight my time (New Zealand) and follow your advice.

Regarding the addons.cfg file, is there a specific format for specifying the binding or will this be obvious when I open the file?

Cheers,
Mike

You shouldnā€™t have any problem when you give it a look. The file is documented pretty well inside.

Jim,

OK, that was better, but I still have few minor issues which I will solve before the next time I update e.g. by adding more info to the addons.cfg file e.g. action and persistence settings etcā€¦

One thing that I noticed is lost every time is the sitemap setting for the basic and classic UI. Is there anywhere I can preset these values?

Once I have this all sorted I will publish my process to help other Windows users of OH2.

Cheers,
Mike

When you say you are losing the sitemap settings, what exactly is being lost? If you have sitemaps in the config directory, they should not be touched. If you have configuration options for the UI interfaces themselves that are being lost, ie language, etc. then this might be a bug. I would suspect those settings should be stored in mapdb, but perhaps they are not. Do you lose those settings if you just do a restart without any update/removal?

I think the settings are probably stored in the mapdb that you nuked as part of the upgrade process.

All that is being lost is the pointer to the sitemap in the config for the UI. It was defaulting back to ā€œ_defaultā€ for both the baaic and classic UI after the update.

I have noticed happen with the classic UI after restarts, but the basic UI seems to hold the value.

I plan to retest after I add some more data to the addons.cfg file, I might try this tonight.

Ya thats wiped.

Always reset to default and png manually after nightly Script.

Hi!
You can adjust the default sitemap in the services folder: https://github.com/cyberkov/my-openhab-config/blob/master/services/basicui.cfg
This setting is always picked up, even when the db gets lost.

I hope this helps :slight_smile:
Cheers Hannes

1 Like

Thank you, I will check this out before my next update.
Cheers,
Mike

I have just a about got my process to update a Windows OH2 system finished, thanks to everyone that has responded to my questions.

I have written a batch file that takes a backup copy and then prepares the openHAB directory structure for updating. Here it is in case it is of any help to anyone else.

@echo Please confirm that you have shut down openHAB. @echo =============================================== @echo This routine will backup openHAB and then prepare for updating to the latest snapshot. @echo ====================================================================================== pause cd\oh_backup del *.* /s /q cd\ xcopy c:\openhab\*.* c:\oh_backup /v /q /s /e /h rd c:\openhab\runtime /s /q del /s /f /q c:\openhab\userdata\cache\*.* for /f %%f in ('dir /ad /b c:\openhab\userdata\cache\') do rd /s /q c:\openhab\userdata\cache\%%f del /s /f /q c:\openhab\userdata\tmp\*.* for /f %%f in ('dir /ad /b c:\openhab\userdata\tmp\') do rd /s /q c:\openhab\userdata\tmp\%%f @echo Task completed pause

My last bit to solve is when extracting the new snapshot as it is easy to miss that addons.cfg and runtime.cfg are overwritten. I can take care of that by restoring these 2 files from my backup copy immediately after extracting the new snapshot.

My question is should I also do this for the keystore (wherever that is located) for when it might be used in future?

Cheers,
Mike.

This repo is no longer available. :frowning:

Yes, thatā€™s right. I donā€™t use OH2 yet, so I donā€™t have a OH2-version for nightly update. My last working version for openHAB 1:

#!/bin/bash

# This version includes getting HABmin and
# functionality to get the latest Snapshot without knowing it's number, version or status (Snapshot or not)
# it also includes support for grafana

. /lib/lsb/init-functions

# by default getsnap gets information from /etc/default/getsnap
getsnapconf=/etc/default/getsnap.cfg
# ohpath is the real path of openHAB-files
ohpath=/opt/inst/
# buildpath is the web-adress of build-server
# buildpath=https://openhab.ci.cloudbees.com/job/openHAB/
# buildpath=https://openhab-ci.innoq.io/jenkins/view/openHAB/job/openhab-1/
buildpath=https://openhab-ci.innoq.io/jenkins/view/openHAB/job/
buildname=openhab-1-rc
if  [ "$#" -eq 0 ]
 then
  log_daemon_msg "Get lastStableBuild-Number of ${buildname}"
  number=`wget --quiet -O  - ${buildpath}${buildname}/lastStableBuild | sed -n 's/^\(.*\)\(<title>openhab-1-rc .\)\([0-9]\{2,4\}\)\(.*\)$/\3/p'`
  log_end_msg $?
  echo lastBuild-Number is ${number}
  webpath=${buildpath}${buildname}/lastStableBuild/artifact/distribution/target/
  echo ${webpath}
 else
  if  [ "$#" -ne 1 ]
   then
    echo "get Snapshot of openhab"
    echo ""
    echo "Usage: $(basename $0) [Snapshotnumber]"
    exit 1
  fi
  number=${1}
  webpath=${buildpath}${buildname}/${number}/artifact/distribution/target/
fi

log_daemon_msg "Get openHAB-Version-Number of ${buildname} ${number}"
wget  --quiet -O /tmp/getsnap.data ${buildpath}${buildname}/${number}/
version=`sed -n 's/^\(.*\)\(artifact\/distribution\/target\/distribution-\)\([0-9]\.[0-9]\.[0-9]\)\(.*\)$/\3/p' /tmp/getsnap.data`
snapshot=`sed -n 's/^\(.*\)\(artifact\/distribution\/target\/distribution-\)\([0-9]\.[0-9]\.[0-9]\)\(.*\)\(-runtime.zip.*\)$/\4/p' /tmp/getsnap.data`
# version=`wget --quiet -O - ${buildpath}${number}/ | sed -n 's/^\(.*\)\(artifact\/distribution\/target\/distribution-\)\([0-9]\.[0-9]\.[0-9]\)\(.*\)$/\3/p'`
# snapshot=`wget --quiet -O - ${buildpath}${number}/ | sed -n 's/^\(.*\)\(artifact\/distribution\/target\/distribution-\)\([0-9]\.[0-9]\.[0-9]\)\(.*\)\(-runtime.zip.*\)$/\4/p'`
log_end_msg $?
if [ -z "$version" ]
 then
  echo "fatal error!"
  echo "${number} not found on server!"
  exit 1
fi
echo Nightly-Version is ${version}
if [ -n "$snapshot" ]
 then
  echo and is a ${snapshot}
fi
dist=-${version}${snapshot}

# create path
mkdir ${ohpath}1.8.0-${number}
mkdir ${ohpath}1.8.0-${number}/zips
cd ${ohpath}1.8.0-${number}/zips

echo "Created Directory ${ohpath}${version}-${number}"
echo "let's download openHAB${dist}-${number}"

# get snapshot
  log_daemon_msg "getting runtime"
   wget --quiet ${webpath}distribution${dist}-runtime.zip
  log_end_msg $?
  log_daemon_msg "unzipping runtime"
   unzip -q distribution${dist}-runtime.zip -d ../runtime
  log_end_msg $?
  log_daemon_msg "getting addons"
   wget --quiet ${webpath}distribution${dist}-addons.zip
  log_end_msg $?
  log_daemon_msg "unzipping addons to addons_inactive"
   unzip -q distribution${dist}-addons.zip -d ../runtime/addons_inactive
  log_end_msg $?

while read line
 do
case ${line:0:1} in
 \#)
;;
 *)
  case ${line:0:-1} in
 macos_designer)
  log_daemon_msg "getting MacOSX-Designer"
   wget --quiet ${webpath}distribution${dist}-designer-macosx64.zip
  log_end_msg $?
  log_daemon_msg "unzipping MacOSX-Designer"
   unzip -q distribution${dist}-designer-macosx64.zip -d ../ide
  log_end_msg $?
;;
 linux32_designer)
  log_daemon_msg "getting Linux32bit-Designer"
   wget --quiet ${webpath}distribution${dist}-designer-linux.zip
  log_end_msg $?
  log_daemon_msg "unzipping Linux32bit-Designer"
   unzip -q distribution${dist}-designer-linux.zip -d ../ide
  log_end_msg $?
;;
 linux64_designer)
  log_daemon_msg "getting Linux64bit-Designer"
   wget --quiet ${webpath}distribution${dist}-designer-linux64bit.zip
  log_end_msg $?
  log_daemon_msg "unzipping Linux64bit-Designer"
   unzip -q distribution${dist}-designer-linux64bit.zip -d ../ide
  log_end_msg $?
;;
 windows_designer)
  log_daemon_msg "getting Windows-Designer"
   wget --quiet ${webpath}distribution${dist}-designer-win.zip
  log_end_msg $?
#  log_daemon_msg "unzipping Windows-Designer"
#   unzip -q distribution${dist}-designer-win.zip -d ../ide
#  log_end_msg $?
;;
 demo)
  log_daemon_msg "getting demo"
   wget --quiet ${webpath}distribution${dist}-demo.zip
  log_end_msg $?
  log_daemon_msg "unzipping demo"
  unzip -q distribution${dist}-demo.zip -d ../runtime/demo
  log_end_msg $?
;;
 greent)
  log_daemon_msg "getting greent"
   wget --quiet ${webpath}distribution${dist}-greent.zip
  log_end_msg $?
  log_daemon_msg "unzipping greent"
  unzip -q distribution${dist}-greent.zip -d ../runtime/webapps
  log_end_msg $?
;;
 habmin)
  log_daemon_msg "getting HABmin"
   wget -nv https://github.com/cdjackson/HABmin/archive/master.zip
  log_end_msg $?
  log_daemon_msg "unzipping HABmin"
   unzip -q master.zip -d ../runtime/webapps
   mv ../runtime/webapps/HABmin-master ../runtime/webapps/habmin
   mv ../runtime/webapps/habmin/addons/org.openhab.*.jar ../runtime/addons/
   if [ -e ../runtime/addons_inactive/org.openhab.binding.zwave${dist}.jar ]
     then
       mv ../runtime/addons_inactive/org.openhab.binding.zwave${dist}.jar ../runtime/addons/
   fi
  log_end_msg $?
;;
*)
  log_daemon_msg "activated ${line}"
  mv ../runtime/addons_inactive/org.openhab.${line:0:-1}${dist}.jar ../runtime/addons/
  log_end_msg $?
;;
esac
;;
esac
done < ${getsnapconf}

cd ../runtime
touch ./${number}

echo "create links..."
# link configs, images and databases
mv ./configurations ./configurations_old
mv ./etc ./etc_old
mv ./webapps/images ./webapps/images_old

ln -s ${ohpath}configurations/ ./configurations
ln -s ${ohpath}etc/ ./etc
ln -s ${ohpath}webapps/images/ ./webapps/images
if [ -e ${ohpath}webapps/grafana ]
  then
    ln -s ${ohpath}webapps/grafana/ ./webapps/grafana
fi
if [ -e ${ohpath}webapps/weather-data ]
  then
    ln -s ${ohpath}webapps/weather-data/ ./webapps/weather-data
fi
if [ -e ${ohpath}webapps/static/uuid ]
  then
    cp ${ohpath}webapps/static/uuid ./webapps/static/
fi
if [ -e ${ohpath}webapps/static/secret ]
  then
    cp ${ohpath}webapps/static/secret ./webapps/static/
fi

chmod 755 ./start*.sh

echo "copy default.cfg and logback.xml"
cp configurations_old/openhab_default.cfg ./configurations
mv configurations/logback.xml ./configurations/logback.xml.old
mv configurations/logback_debug.xml ./configurations/logback_debug.xml.old
cp configurations_old/logback.xml ./configurations
cp configurations_old/logback_debug.xml ./configurations

mv /oh/openhab /oh/openhab_old-${number}
ln -s ${ohpath}${version}-${number}/runtime /oh/openhab

echo "ready to switch to openHAB${dist}-${number}"

exit 0

and the config (/etc/default/getsnap.cfg)

###########################################################
# at least runtime and addons will be downloaded;         #
# if more then one designer is downloaded,                #
# the versions will overwrite files in path /ohpath/ide/  #
# getsnap will get the files in order                     #
###########################################################
# linux32_designer
# linux64_designer
# macos_designer
windows_designer
demo
greent
###########################################################
#                                                         #
# starting addons from here;                              #
# Lines with # will be ignored                            #
# no spaces at start of line!                             #
# no spaces at end of line!                               #
#                                                         #
###########################################################
action.squeezebox
binding.astro
binding.exec
binding.http
binding.knx
#binding.mpd
binding.networkhealth
binding.ntp
binding.squeezebox
binding.tcp
binding.vdr
binding.wol
binding.yamahareceiver
binding.weather
io.squeezeserver
#persistence.db4o
#persistence.gcal
persistence.logging
persistence.rrd4j
persistence.mysql*
persistence.influxdb
persistence.influxdb08
#action.xmpp
###########################################################
#                                                         #
# getting habmin at the end; this will reduce errors      #
# caused by double-trying to move zwave-binding if in     #
# list above                                              #
#                                                         #
###########################################################
#
habmin

@chris and @xsnrg

I tried below steps to update OH2, but sometimes face problem.
1 Habmin stay still the old version.
2 within Habmin, can not see items which are defined in demo2.sitemap.

$mkdir hab down
$cd hab

$rm -rf /tmp/
$rm -rf /cache/
$cp /conf ./ -dpR
$cp /userdata ./ -dpR

$cd ā€¦
$./makeHAB (this is your script without the designer part located at
https://github.com/xsnrg/OpenHAB2-tools)
$cd hab
$vi conf/services/addons.cfg
$./start.sh

Basically,
1 I copy userdata/ conf/ directory under old OH2 to hab/.
2 run makeHAB which is your script
3 edit addons.cfg

Please correct me if I do something wrong and please give some suggestion if possible.
Thank you very much.

Re: HABmin version

I havenā€™t done this yet, but I suspect that you will need to delete the existing habmin jar file from the addons directory. You may need to do this before you update to the latest build, but not sure.

Then restart openHAB and install HABmin from the Paper UI.

I did it this morning, and you are correct. Delete from addons directory, and install using PaperUI, or add to your conf/services/addons.cfg file before you restart OH.

Thank you for your idea.

1 I got if deleting habmin under addons/ and restart.

1 Should I do this?
# A comma-separated list of UIs to install (e.g. ā€œbasic,paperā€)
ui = basic, paper, habmin

2 However, I manually copy here

3 I can not find habmin in my paper UI.

Thank you.

Yes. This is what I have in my addons.cfg

When you ran makeHAB, are you sure it deleted the userdata/tmp and userdata/cache directories in the main openhab directory?

Thank you very much.

Yes.
But never mind, it seems work by manual copying. Thank you, though.

I think you are saying install by PaperUI or add to your conf/services/addons.cfg file instead of both of them.

However, one thing is not reasonable to me is that another binding called orvibo, which I also add into conf/services/addons.cfg, is installed automatically without touching PaperUI.
However, same thing does not happen on Hambin.

Thank you.