openhab / openhab-linuxpkg

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

Prevent init.d script from running on RPM. #41

Closed BClark09 closed 7 years ago

BClark09 commented 7 years ago

Deb and RPM init daemons are simply incompatible. We should only allow RPM systemd processes until we can make a separate init script for RHEL systems.

Additionally, this PR defines some simple placeholders for the special OSes that can use dpkg but don't have the same daemon logging functions.

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

theoweiss commented 7 years ago

Hi @BClark09,

you will need different init scripts for deb and rpm. Again elasticsearch does it like this:

Deb sysV: https://github.com/elastic/elasticsearch/blob/master/distribution/deb/src/main/packaging/init.d/elasticsearch

RPM sysV: https://github.com/elastic/elasticsearch/blob/master/distribution/rpm/src/main/packaging/init.d/elasticsearch

systemd rpm and deb: https://github.com/elastic/elasticsearch/blob/master/distribution/src/main/packaging/systemd/elasticsearch.service

Finding the right script is a bit more complicated: https://github.com/elastic/elasticsearch/blob/master/distribution/build.gradle#L292

May be it could be solved more easily by:

ospackage {
...
}

buildDeb {
 ...
 into('/etc/initi.d') {
  from 'src/dist/deb/init.d/$initScript
 }
}
buildRpm {
 into('/etc/initi.d') {
  from 'src/dist/rpm/init.d/$initScript
 }
}
BClark09 commented 7 years ago

Thanks @theoweiss, that's really helpful. I will try to get round making an init script for the rpm side when I can, but for now wanted to get at least systemd scripts working.