hektiker1983 / openhab

Automatically exported from code.google.com/p/openhab
0 stars 0 forks source link

openhab Debian deb packages #370

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
1. Feature Description
Create debian deb packages for the openhab software, using the maven build.

2. Example Use Case
Install openhab on Debian or a Debian based Distribution like Raspbian using 
the dpkg package management tools.

Original issue reported on code.google.com by theo.weiss@gmail.com on 6 Jul 2013 at 4:20

GoogleCodeExporter commented 8 years ago
How is this related to Issue 119? Both are about creating deb packages. Are deb 
packages for Raspbian different ones than for Ubuntu?

Original comment by kai.openhab on 6 Jul 2013 at 8:40

GoogleCodeExporter commented 8 years ago
Are these ubuntu packages from Uwe available?

I think deb packages for ubuntu have a good chance to work on debian / raspbian 
if a SysV-Init script is used. Ubuntu uses upstart as default init system. 
upstart has its own configuration format, but  can handle "legacy" SysV-init 
scripts.
Debian uses SysV-Init as default (upstart is available, but not the default), 
which can not handle upstart "scripts".

Original comment by theo.weiss@gmail.com on 7 Jul 2013 at 2:58

GoogleCodeExporter commented 8 years ago
I pushed the changes needed to build deb files with maven to my repo at 
https://theo.weiss@code.google.com/r/theoweiss-tinkerforge2/.

If you call "maven package" you will - for now - get two deb files:
distribution/target/openhab-runtime-1.3.0-SNAPSHOT.deb
bundles/binding/org.openhab.binding.tinkerforge/target/openhab-addon-binding-tin
kerforge-1.3.0-SNAPSHOT.deb

Changes to pom files:
pom.xml
distribution/pom.xml
bundles/binding/org.openhab.binding.tinkerforge/pom.xml

All pom files from addons will need changes to get the deb packages. 
I haven't changed these files because think it would be helpful, if a real 
*maven guru* reviews the changes. I'm sure some optimizations can be done.

Most of my work has gone into changes of the installation directories. I tried 
to achieve a standard linux hierarchy:
- configuration:
(files will not be removed by updates or uninstallation of the runtime)
/etc/openhab
- configuration for the init script:
/etc/default/openhab
- init script:
/etc/init.d/openhab
- installation of the runtime and addons:
(these files should only be changed by installation or updates of runtime or 
addons packages)
/opt/openhab (may be should moved to another place)
- files which change during runtime
/var/lib/openhab
- log files
/var/log/openhab

You will find the used config files in: distribution/src/deb/

The deb package will add a user and group called "openhab", which are used 
running the server process. Therefore openhab will have no root privileges. If 
a binding needs more privileges - like some configurations of the exec binding 
- sudo has to be used. If this is not possible the server can run as root by 
changing /etc/default/openhab.

openhab will be added automatically to the system init using a post 
installation script.

I have tested the packages with ubuntu 1204 and raspbian.

So much for now. I'm curious about your feedback.

Regards,
Theo

Original comment by theo.weiss@gmail.com on 19 Jul 2013 at 8:53

GoogleCodeExporter commented 8 years ago

Original comment by teichsta on 13 Aug 2013 at 8:03

GoogleCodeExporter commented 8 years ago
# pom.xml
* deb.maintainer should be changed to openHAB.org or openHAB.org Community not 
you as individual since you won't maintain ALL packages over time.

# distribution/pom.xml
* plugin should be added under <plugins> rather than <pluginmanagement>
* version can be omitted

# bundles/binding/org.openhab.binding.tinkerforge/pom.xml
* deb.name should be as similar as possible to the artifact id. In this case it 
is org.openhab.binding.tinkerforge so the deb should be named 
"org-openhab-binding-tinkerforge". Would that naming scheme be compatible with 
the Unix-world?
* deb.description should be the same as the <name>-tag. Could that be achieved 
by using it as variable?

Original comment by teichsta on 1 Sep 2013 at 8:09

GoogleCodeExporter commented 8 years ago
Sorry I just realized that the infos on the issue are not up to date.
You will get deb files for all bindings, io and persistence add ons (newer 
bundles are missing for now).
Here is a list:

mac:theo$ grep -r jdeb *
bundles/binding/org.openhab.binding.asterisk/pom.xml:       <artifactId>jdeb</artifac
tId>
bundles/binding/org.openhab.binding.bluetooth/pom.xml:      <artifactId>jdeb</artifa
ctId>
bundles/binding/org.openhab.binding.configadmin/pom.xml:        <artifactId>jdeb</arti
factId>
bundles/binding/org.openhab.binding.cups/pom.xml:       <artifactId>jdeb</artifactId>
bundles/binding/org.openhab.binding.dmx/pom.xml:        <artifactId>jdeb</artifactId>
bundles/binding/org.openhab.binding.exec/pom.xml:       <artifactId>jdeb</artifactId>
bundles/binding/org.openhab.binding.fritzbox/pom.xml:       <artifactId>jdeb</artifac
tId>
bundles/binding/org.openhab.binding.homematic/pom.xml:              <artifactId>jdeb</arti
factId>
bundles/binding/org.openhab.binding.http/pom.xml:       <artifactId>jdeb</artifactId>
bundles/binding/org.openhab.binding.hue/pom.xml:        <artifactId>jdeb</artifactId>
bundles/binding/org.openhab.binding.ihc/pom.xml:        <artifactId>jdeb</artifactId>
bundles/binding/org.openhab.binding.knx/pom.xml:        <artifactId>jdeb</artifactId>
bundles/binding/org.openhab.binding.koubachi/pom.xml:               <artifactId>jdeb</artif
actId>
bundles/binding/org.openhab.binding.modbus/pom.xml:     <artifactId>jdeb</artifactI
d>
bundles/binding/org.openhab.binding.mpd/pom.xml:        <artifactId>jdeb</artifactId>
bundles/binding/org.openhab.binding.networkhealth/pom.xml:      <artifactId>jdeb</ar
tifactId>
bundles/binding/org.openhab.binding.novelanheatpump/pom.xml:        <artifactId>jdeb</
artifactId>
bundles/binding/org.openhab.binding.ntp/pom.xml:        <artifactId>jdeb</artifactId>
bundles/binding/org.openhab.binding.onewire/pom.xml:        <artifactId>jdeb</artifact
Id>
bundles/binding/org.openhab.binding.onkyo/pom.xml:              <artifactId>jdeb</artifact
Id>
bundles/binding/org.openhab.binding.plcbus/pom.xml:     <artifactId>jdeb</artifactI
d>
bundles/binding/org.openhab.binding.plugwise/pom.xml:       <artifactId>jdeb</artifac
tId>
bundles/binding/org.openhab.binding.pulseaudio/pom.xml:     <artifactId>jdeb</artif
actId>
bundles/binding/org.openhab.binding.rfxcom/pom.xml:             <artifactId>jdeb</artifac
tId>
bundles/binding/org.openhab.binding.samsungtv/pom.xml:              <artifactId>jdeb</arti
factId>
bundles/binding/org.openhab.binding.serial/pom.xml:     <artifactId>jdeb</artifactI
d>
bundles/binding/org.openhab.binding.snmp/pom.xml:       <artifactId>jdeb</artifactId>
bundles/binding/org.openhab.binding.sonos/pom.xml:      <artifactId>jdeb</artifactId
>
bundles/binding/org.openhab.binding.tcp/pom.xml:        <artifactId>jdeb</artifactId>
bundles/binding/org.openhab.binding.tinkerforge/pom.xml:            
<artifactId>jdeb</artifactId>
bundles/binding/org.openhab.binding.urtsi/pom.xml:              <artifactId>jdeb</artifact
Id>
bundles/binding/org.openhab.binding.vdr/pom.xml:        <artifactId>jdeb</artifactId>
bundles/binding/org.openhab.binding.wol/pom.xml:        <artifactId>jdeb</artifactId>
bundles/io/org.openhab.io.dropbox/pom.xml:      <artifactId>jdeb</artifactId>
bundles/io/org.openhab.io.multimedia.tts.freetts/pom.xml:       <artifactId>jdeb</art
ifactId>
bundles/io/org.openhab.io.multimedia.tts.marytts/pom.xml:               <artifactId>jdeb</a
rtifactId>
bundles/persistence/org.openhab.persistence.cosm/pom.xml:       <artifactId>jdeb</art
ifactId>
bundles/persistence/org.openhab.persistence.db4o/pom.xml:       <artifactId>jdeb</art
ifactId>
bundles/persistence/org.openhab.persistence.exec/pom.xml:       <artifactId>jdeb</art
ifactId>
bundles/persistence/org.openhab.persistence.logging/pom.xml:        <artifactId>jdeb</
artifactId>
bundles/persistence/org.openhab.persistence.rrd4j/pom.xml:      <artifactId>jdeb</ar
tifactId>
bundles/persistence/org.openhab.persistence.sense/pom.xml:      <artifactId>jdeb</ar
tifactId>
bundles/persistence/org.openhab.persistence.sql/pom.xml:        <artifactId>jdeb</arti
factId>
bundles/persistence/org.openhab.persistence.sql.mysql/pom.xml:      <artifactId>jdeb
</artifactId>
bundles/pom.xml:                <artifactId>jdeb</artifactId>
bundles/pom.xml:                            <goal>jdeb</goal>
distribution/pom.xml:            <artifactId>jdeb</artifactId>

Original comment by theo.weiss@gmail.com on 1 Sep 2013 at 8:55

GoogleCodeExporter commented 8 years ago
A deb.name org-openhab-binding-tinkerforge would be quite unusual, I think 
openhab-binding-tinkerforge would be OK.
The deb.description should be a short description of the software, may be 
something like this "openHAB binding which connects the TinkerForge devices to 
the openHAB event bus"

Here are some examples from raspian:

root@raspberrypi:~# dpkg -l |grep open
ii  libltdl7:armhf                        2.4.2-1.1                            
armhf        A system independent dlopen wrapper for GNU libtool
ii  libobrender27                         3.5.0-7                              
armhf        rendering library for openbox themes
ii  libobt0                               3.5.0-7                              
armhf        parsing library for openbox
ii  libopenjpeg2:armhf                    1.3+dfsg-4.6                         
armhf        JPEG 2000 image compression/decompression library
ii  netcat-openbsd                        1.105-7                              
armhf        TCP/IP swiss army knife
ii  openbox                               3.5.0-7                              
armhf        standards compliant, fast, light-weight, extensible window manager
ii  openhab-addon-binding-exec            1.3.0~SNAPSHOT                       
all          openhab addon binding exec
ii  openhab-addon-tinkerforge             1.3                                  
all          openhab addon tinkerforge
ii  openhab-runtime                       1.3                                  
all          openhab runtime
ii  openssh-blacklist                     0.4.1+nmu1                           
all          list of default blacklisted OpenSSH RSA and DSA keys
ii  openssh-blacklist-extra               0.4.1+nmu1                           
all          list of non-default blacklisted OpenSSH RSA and DSA keys
ii  openssh-client                        1:6.0p1-4                            
armhf        secure shell (SSH) client, for secure access to remote machines
ii  openssh-server                        1:6.0p1-4                            
armhf        secure shell (SSH) server, for secure access from remote machines
ii  openssl                               1.0.1e-2+rpi1                        
armhf        Secure Socket Layer (SSL) binary and related cryptographic tools

Original comment by theo.weiss@gmail.com on 1 Sep 2013 at 9:06

GoogleCodeExporter commented 8 years ago
I think the most critical changes which should be reviewed are the changes to 
the openhab launcher args. You will find them in 
distribution/src/deb/etc/init.d/openhab:

JAVA_ARGS="-Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true 
-Djetty.port=${HTTP_PORT} \
 -Dopenhab.configfile="${OPENHAB_CONF_DIR}/configurations/openhab.cfg" \
 -Dopenhab.configdir="${OPENHAB_CONF_DIR}/configurations" \
 -Djetty.home="${OPENHAB_DIR}" \
 -Djetty.port.ssl=${HTTPS_PORT} -Djetty.config="${OPENHAB_CONF_DIR}/jetty" \
 -Djetty.logs="${OPENHAB_LOG_DIR}" -Djetty.rundir="${OPENHAB_DIR}" \
 -Dlogback.configurationFile="${OPENHAB_CONF_DIR}"/logback.xml \
 -Dfelix.fileinstall.dir="${OPENHAB_DIR}"/addons -Djava.library.path="${OPENHAB_DIR}"/lib \
 -Djava.security.auth.login.config="${OPENHAB_CONF_DIR}"/login.conf \
 -Dorg.quartz.properties="${OPENHAB_CONF_DIR}"/quartz.properties -Djava.awt.headless=true \
 -jar ${LAUNCHER} \
 -configuration ${OPENHAB_WORKSPACE_DIR} \
 -data ${OPENHAB_WORKSPACE_DIR} \
 -console ${TELNET_PORT}"

The jetty configuration lives under /etc/openhab/jetty/etc!
jetty.xml is slightly changed:

mac:theo$ diff distribution/openhabhome/etc/jetty.xml 
distribution/src/deb/etc/openhab/jetty/etc/jetty.xml 
89c89
<               <Set name="Keystore"><Property name="jetty.home" default="." 
/>/etc/keystore</Set>
---
>               <Set name="Keystore"><SystemProperty name="jetty.config" default="." 
/>/etc/keystore</Set>
192c192
<           <Set name="filename"><Property name="jetty.home" 
default="."/>/logs/yyyy_mm_dd.request.log</Set>
---
>           <Set name="filename"><SystemProperty name="jetty.logs" 
default="./logs"/>/yyyy_mm_dd.request.log</Set>

By the way an apt-repo for openHAB would be nice.

Original comment by theo.weiss@gmail.com on 1 Sep 2013 at 9:35

GoogleCodeExporter commented 8 years ago
ok, thanks!

> By the way an apt-repo for openHAB would be nice.

what Du we have to do to get one? Any hints where to find comprehensive 
information?

Original comment by teichsta on 1 Sep 2013 at 9:58

GoogleCodeExporter commented 8 years ago
I just pushed some updated pom.xml files. 

Original comment by theo.weiss@gmail.com on 2 Sep 2013 at 6:32

GoogleCodeExporter commented 8 years ago
As far as I know we will need a debian or ubuntu machine to create the repo. 
The repo files must be transferred to a web server which serves the files. The 
deb files must be signed using a gpg key, this seems to be supported by jdeb.

Unfortunatly I found no way to create the repo from maven.

Here are some web links:
https://wiki.debian.org/HowToSetupADebianRepository
https://wiki.debian.org/SettingUpSignedAptRepositoryWithReprepro
http://www.gambaru.de/blog/2012/09/11/reprepro-das-eigene-paketarchiv-fur-debian
-und-ubuntu/

Original comment by theo.weiss@gmail.com on 2 Sep 2013 at 7:58

GoogleCodeExporter commented 8 years ago
After talking to a friend of mine who has some deeper knowledge about Debian 
repos, I think it may be possible to use maven to build the repo.
A description of the repo structure can be found here 
https://wiki.debian.org/RepositoryFormat 

May be the assembly plugin could be helpful.

Original comment by theo.weiss@gmail.com on 3 Sep 2013 at 7:55

GoogleCodeExporter commented 8 years ago
unfortunately this change won't make it into 1.3 - since we will move the 
project (or at least part of it) to different infrastructure we should better 
work on the packaging issue in that context. Thanks for contributing, we'll 
come to it later.

Original comment by teichsta on 6 Sep 2013 at 2:46

GoogleCodeExporter commented 8 years ago
It seems that this issue hasn't been migrated to github? This happened on 
purpose?

Original comment by theo.weiss@gmail.com on 2 Dec 2013 at 7:49

GoogleCodeExporter commented 8 years ago
I guess this got accidentially lost as its status is ReadyForReview... Will ask 
Thomas to migrate this (and a few more) issue(s) as well.

Original comment by kai.openhab on 2 Dec 2013 at 9:55

GoogleCodeExporter commented 8 years ago

Original comment by kai.openhab on 5 Dec 2013 at 10:23

GoogleCodeExporter commented 8 years ago
Was this issue moved to github?
I could not find it.

Original comment by theo.weiss@gmail.com on 10 Dec 2013 at 8:50

GoogleCodeExporter commented 8 years ago
has been migrated to https://github.com/openhab/openhab/issues/641

Original comment by teichsta on 10 Dec 2013 at 10:33