openhab / openhab-distro

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

openHAB directory is not relocatable #860

Open dottedmag opened 5 years ago

dottedmag commented 5 years ago

openHAB writes absolute paths to userdata and hence moving its directory is not trivial (one has to do something like seding the userdata).

oH sets the directory to the absolute path here: https://github.com/openhab/openhab-distro/blob/14a9fd15f45960a7651bbc299b9f8ee876d6a8e0/distributions/openhab/src/main/resources/bin/oh2_dir_layout#L35

Here's an example from my test installation:

% grep -r /Users/dottedmag . | grep -v logs
Binary file ./userdata/cache/org.eclipse.osgi/framework.info.96 matches
./userdata/config/org/jupnp.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.jupnp.cfg"
./userdata/config/org/eclipse/smarthome/audio.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.eclipse.smarthome.audio.cfg"
./userdata/config/org/eclipse/smarthome/voice.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.eclipse.smarthome.voice.cfg"
./userdata/config/org/ops4j/pax/web.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.ops4j.pax.web.cfg"
./userdata/config/org/ops4j/pax/web.config:org.ops4j.pax.web.config.file="/Users/dottedmag/w/home-automation/openhab/runtime/etc/jetty.xml"
./userdata/config/org/ops4j/pax/url/mvn.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.ops4j.pax.url.mvn.cfg"
./userdata/config/org/ops4j/pax/url/mvn.config:org.ops4j.pax.url.mvn.defaultRepositories="file:/Users/dottedmag/w/home-automation/openhab/runtime/system@id\=system.repository@snapshots,\ file:/Users/dottedmag/w/home-automation/openhab/userdata/tmp/kar@id\=kar.repository@multi@snapshots,\ file:/Users/dottedmag/w/home-automation/openhab/userdata/system@id\=child.system.repository@snapshots"
./userdata/config/org/ops4j/pax/url/mvn.config:org.ops4j.pax.url.mvn.localRepository="/Users/dottedmag/w/home-automation/openhab/userdata/tmp/mvn"
./userdata/config/org/ops4j/pax/logging.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.ops4j.pax.logging.cfg"
./userdata/config/org/apache/karaf/log.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.log.cfg"
./userdata/config/org/apache/karaf/jaas.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.jaas.cfg"
./userdata/config/org/apache/karaf/features.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.features.cfg"
./userdata/config/org/apache/karaf/features/repos.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.features.repos.cfg"
./userdata/config/org/apache/karaf/kar.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.kar.cfg"
./userdata/config/org/apache/karaf/kar.config:karStorage="/Users/dottedmag/w/home-automation/openhab/userdata/tmp/kar"
./userdata/config/org/apache/karaf/shell.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.shell.cfg"
./userdata/config/org/apache/karaf/shell.config:hostKey="/Users/dottedmag/w/home-automation/openhab/userdata/etc/host.key"
./userdata/config/org/apache/karaf/command/acl/scope_bundle.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.command.acl.scope_bundle.cfg"
./userdata/config/org/apache/karaf/command/acl/jaas.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.command.acl.jaas.cfg"
./userdata/config/org/apache/karaf/command/acl/kar.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.command.acl.kar.cfg"
./userdata/config/org/apache/karaf/command/acl/bundle.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.command.acl.bundle.cfg"
./userdata/config/org/apache/karaf/command/acl/shell.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.command.acl.shell.cfg"
./userdata/config/org/apache/karaf/command/acl/system.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.command.acl.system.cfg"
./userdata/config/org/apache/karaf/command/acl/config.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.command.acl.config.cfg"
./userdata/config/org/apache/karaf/command/acl/feature.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.karaf.command.acl.feature.cfg"
./userdata/config/org/apache/felix/fileinstall/351e53bd-e924-46e3-a384-9feb7eef114e.config:felix.fileinstall.dir="/Users/dottedmag/w/home-automation/openhab/addons"
./userdata/config/org/apache/felix/fileinstall/351e53bd-e924-46e3-a384-9feb7eef114e.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.felix.fileinstall-deploy.cfg"
./userdata/config/org/apache/felix/fileinstall/351e53bd-e924-46e3-a384-9feb7eef114e.config:felix.fileinstall.tmpdir="/Users/dottedmag/w/home-automation/openhab/userdata/tmp/bundles"
./userdata/config/org/apache/felix/fileinstall/64e8fb94-2b2a-49ff-b884-770f384aec11.config:felix.fileinstall.dir="/Users/dottedmag/w/home-automation/openhab/addons"
./userdata/config/org/apache/felix/fileinstall/64e8fb94-2b2a-49ff-b884-770f384aec11.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.felix.fileinstall-deploy.cfg"
./userdata/config/org/apache/felix/fileinstall/64e8fb94-2b2a-49ff-b884-770f384aec11.config:felix.fileinstall.tmpdir="/Users/dottedmag/w/home-automation/openhab/userdata/tmp/bundles"
./userdata/config/org/apache/felix/eventadmin/impl/EventAdmin.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/org.apache.felix.eventadmin.impl.EventAdmin.cfg"
./userdata/config/jmx/acl/org/apache/karaf/bundle.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/jmx.acl.org.apache.karaf.bundle.cfg"
./userdata/config/jmx/acl/org/apache/karaf/config.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/jmx.acl.org.apache.karaf.config.cfg"
./userdata/config/profile.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/profile.cfg"
./userdata/config/com/eclipsesource/jaxrs/connector.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/com.eclipsesource.jaxrs.connector.cfg"
./userdata/config/com/eclipsesource/jaxrs/swagger/config.config:felix.fileinstall.filename="file:/Users/dottedmag/w/home-automation/openhab/userdata/etc/com.eclipsesource.jaxrs.swagger.config.cfg"
./userdata/tmp/instances/instance.properties:item.0.loc = /Users/dottedmag/w/home-automation/openhab/userdata

Note that majority of these are keys felix.fileinstall.dir and felix.fileinstall.filename — can these be fixed en masse? There are few other absolute paths:

% grep -r /Users/dottedmag . | grep -v logs| grep -v felix.fileinstall
Binary file ./userdata/cache/org.eclipse.osgi/framework.info.96 matches
./userdata/config/org/ops4j/pax/web.config:org.ops4j.pax.web.config.file="/Users/dottedmag/w/home-automation/openhab/runtime/etc/jetty.xml"
./userdata/config/org/ops4j/pax/url/mvn.config:org.ops4j.pax.url.mvn.defaultRepositories="file:/Users/dottedmag/w/home-automation/openhab/runtime/system@id\=system.repository@snapshots,\ file:/Users/dottedmag/w/home-automation/openhab/userdata/tmp/kar@id\=kar.repository@multi@snapshots,\ file:/Users/dottedmag/w/home-automation/openhab/userdata/system@id\=child.system.repository@snapshots"
./userdata/config/org/ops4j/pax/url/mvn.config:org.ops4j.pax.url.mvn.localRepository="/Users/dottedmag/w/home-automation/openhab/userdata/tmp/mvn"
./userdata/config/org/apache/karaf/kar.config:karStorage="/Users/dottedmag/w/home-automation/openhab/userdata/tmp/kar"
./userdata/config/org/apache/karaf/shell.config:hostKey="/Users/dottedmag/w/home-automation/openhab/userdata/etc/host.key"
./userdata/tmp/instances/instance.properties:item.0.loc = /Users/dottedmag/w/home-automation/openhab/userdata
openhab-bot commented 2 years ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/openhab-docker-usr-share-openhab-addons-does-not-exist-after-upgrade-to-oh-3-3-0/136954/3

openhab-bot commented 11 months ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/migrating-from-3-4-on-debian-to-4-0-docker/148074/7