Fix for RPM postinstall on old OpenSUSE distributions

Older OpenSUSE distributions do not ship with systemd and therefore are
using chkconfig, but do not have their scripts placed at /etc/init.d/
This patch is more defensive and adds additional checks in the postinstall
script to prevent aborted post install scripts, which makes the RPM
uninstallable.
This commit is contained in:
Alexander Reelsen 2013-05-13 11:45:30 +02:00
parent 3c58176d29
commit 52654179e7
1 changed files with 8 additions and 1 deletions

View File

@ -11,7 +11,14 @@ if [ $1 -eq 1 ] ; then
if [ -x /sbin/chkconfig -a "$hasBeenEnabledOnStart" == "false" ] ; then
/sbin/chkconfig --add elasticsearch
/etc/init.d/elasticsearch start
# older suse linux distributions do not ship with systemd
# but do not have an /etc/init.d/ directory
# this tries to start elasticsearch on these as well without failing this script
if [ -x /etc/init.d/elasticsearch ] ; then
/etc/init.d/elasticsearch start
elif [ -x /etc/rc.d/init.d/elasticsearch ] ; then
/etc/rc.d/init.d/elasticsearch start
fi
fi
fi