Dominique Leuenberger 2016-03-16 09:34:40 +00:00 committed by Git OBS Bridge
commit e8b35595e3
3 changed files with 190 additions and 14 deletions

View File

@ -1,10 +1,13 @@
Index: keepalived/etc/init.d/keepalived.suse.init
===================================================================
--- keepalived/etc/init.d/keepalived.suse.init.orig 2012-07-18 21:47:24.000000000 +0200
+++ keepalived/etc/init.d/keepalived.suse.init 2012-11-20 17:43:43.261849625 +0100
@@ -3,16 +3,16 @@
--- keepalived/etc/init.d/keepalived.suse.init.orig
+++ keepalived/etc/init.d/keepalived.suse.init
@@ -1,23 +1,24 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: keepalived
-# Provides: keepalived
+# Provides: keepalived
# Required-Start: $remote_fs $syslog
-# Required-Stop : $remote_fs $syslog
-# Default-Start : 3 5
@ -19,9 +22,173 @@ Index: keepalived/etc/init.d/keepalived.suse.init
### END INIT INFO
DAEMON="Keepalived daemon"
-DAEMON="Keepalived daemon"
-DAEMON_BIN="/usr/local/sbin/keepalived"
+DAEMON_BIN="/usr/sbin/keepalived"
DAEMON_CONF="/etc/keepalived/keepalived.conf"
DAEMON_PIDFILE="/var/run/keepalived.pid"
DAEMON_OPT="-d"
-DAEMON_CONF="/etc/keepalived/keepalived.conf"
-DAEMON_PIDFILE="/var/run/keepalived.pid"
-DAEMON_OPT="-d"
+DAEMON='Keepalived daemon'
+DAEMON_BIN='/usr/sbin/keepalived'
+DAEMON_CONF='/etc/keepalived/keepalived.conf'
+DAEMON_SYSCONF='/etc/sysconfig/keepalived'
+DAEMON_PIDFILE='/var/run/keepalived.pid'
+KEEPALIVED_OPTIONS='-d'
#DAEMON_USER="root"
-SUPPORTS_HUP="yes"
+SUPPORTS_HUP='yes'
# "yes" if exist next values in freshclam.conf
# PidFile /var/run/keepalived.pid
# DatabaseOwner root
@@ -25,7 +26,19 @@ SUPPORTS_HUP="yes"
pid_par=${DAEMON_PIDFILE:+"-p $DAEMON_PIDFILE"}
usr_par=${DAEMON_USER:+"-u $DAEMON_USER"}
-test -x $DAEMON_BIN || exit 5
+test -x $DAEMON_BIN || { echo "$DAEMON_BIN not installed or executable";
+ if [ "$1" = "stop" ]; then exit 0;
+ else exit 5; fi; }
+
+
+test -r $DAEMON_CONF || { echo "$DAEMON_CONF not existing or readable";
+ if [ "$1" = "stop" ]; then exit 0;
+ else exit 6; fi; }
+
+# read sysconfig variables that might overwrite the daemon options
+if [ -r "$DAEMON_SYSCONF" ]; then
+ . "$DAEMON_SYSCONF"
+fi
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
@@ -62,70 +75,70 @@ test -e $DAEMON_PIDFILE && ! test -s $DA
case "$1" in
start)
- echo -n "Starting $DAEMON "
- if test ! -f ${DAEMON_CONF}; then
- echo -n >&2 "Configuration file, ${DAEMON_CONF} does not exist. "
- rc_status -s
- exit 6
- fi
- checkproc $pid_par ${DAEMON_BIN}
- case $? in
- 0) echo -n "- Warning: daemon already running. " ;;
- 1) echo -n "- Warning: ${DAEMON_PIDFILE} exists. " ;;
- esac
-# echo "startproc $usr_par $pid_par ${DAEMON_BIN} ${DAEMON_OPT}"
- startproc $usr_par $pid_par ${DAEMON_BIN} ${DAEMON_OPT}
- rc_status -v
- ;;
- stop)
- echo -n "Shutting down $DAEMON "
- checkproc $pid_par ${DAEMON_BIN} || \
- echo -n " Warning: daemon not running. "
- killproc $pid_par -t 10 ${DAEMON_BIN}
- rc_status -v
- ;;
- try-restart|condrestart)
- if test "$1" = "condrestart"; then
- echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
- fi
- $0 status
- if test $? = 0; then
- $0 restart
- else
- rc_reset
- fi
- rc_status
- ;;
- restart)
- $0 stop
- $0 start
- rc_status
- ;;
- force-reload|reload)
- if test "$SUPPORTS_HUP" = "yes"; then
- echo -n "Reload service $DAEMON "
- checkproc $pid_par ${DAEMON_BIN} && \
- touch ${DAEMON_PIDFILE} || \
- echo -n >&2 " Warning: daemon not running. "
- killproc $pid_par -HUP ${DAEMON_BIN}
+ echo -n "Starting $DAEMON "
+ if test ! -f ${DAEMON_CONF}; then
+ echo -n >&2 "Configuration file, ${DAEMON_CONF} does not exist. "
+ rc_status -s
+ exit 6
+ fi
+ checkproc $pid_par ${DAEMON_BIN}
+ case $? in
+ 0) echo -n "- Warning: daemon already running. " ;;
+ 1) echo -n "- Warning: ${DAEMON_PIDFILE} exists. " ;;
+ esac
+# echo "startproc $usr_par $pid_par ${DAEMON_BIN} ${KEEPALIVED_OPTIONS}"
+ startproc $usr_par $pid_par ${DAEMON_BIN} ${KEEPALIVED_OPTIONS}
+ rc_status -v
+ ;;
+ stop)
+ echo -n "Shutting down $DAEMON "
+ checkproc $pid_par ${DAEMON_BIN} || \
+ echo -n " Warning: daemon not running. "
+ killproc $pid_par -t 10 ${DAEMON_BIN}
+ rc_status -v
+ ;;
+ try-restart|condrestart)
+ if test "$1" = "condrestart"; then
+ echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
+ fi
+ $0 status
+ if test $? = 0; then
+ $0 restart
+ else
+ rc_reset
+ fi
+ rc_status
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ rc_status
+ ;;
+ force-reload|reload)
+ if test "$SUPPORTS_HUP" = "yes"; then
+ echo -n "Reload service $DAEMON "
+ checkproc $pid_par ${DAEMON_BIN} && \
+ touch ${DAEMON_PIDFILE} || \
+ echo -n >&2 " Warning: daemon not running. "
+ killproc $pid_par -HUP ${DAEMON_BIN}
rc_status -v
- else
+ else
$0 stop && sleep 3 && $0 start
rc_status
- fi
- ;;
- status)
- echo -n "Checking for $DAEMON "
- checkproc $pid_par ${DAEMON_BIN}
- rc_status -v
- ;;
- probe)
- test ${DAEMON_CONF} -nt ${DAEMON_PIDFILE} && echo reload
- ;;
- *)
- echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
- exit 1
- ;;
+ fi
+ ;;
+ status)
+ echo -n "Checking for $DAEMON "
+ checkproc $pid_par ${DAEMON_BIN}
+ rc_status -v
+ ;;
+ probe)
+ test ${DAEMON_CONF} -nt ${DAEMON_PIDFILE} && echo reload
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
+ exit 1
+ ;;
esac
rc_exit

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Thu Feb 11 10:44:31 UTC 2016 - lars@linux-schulserver.de
- enhanced keepalive-init.patch :
+ replace tabs with spaces
+ read /etc/sysconfig/keepalived, if exists and use the settings
there instead of the default KEEPALIVED_OPTIONS in case the
user changed them
-------------------------------------------------------------------
Thu Jan 28 12:13:36 UTC 2016 - mrueckert@suse.de

View File

@ -1,7 +1,7 @@
#
# spec file for package keepalived
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -34,9 +34,9 @@ Source1: keepalived.service
Source2: keepalive-rpmlintrc
Patch1: keepalive-init.patch
BuildRequires: net-snmp-devel
BuildRequires: snmp-mibs
BuildRequires: openssl-devel
BuildRequires: pkgconfig
BuildRequires: snmp-mibs
%if 0%{?suse_version} > 1110
BuildRequires: pkgconfig(libnl-3.0)
%else
@ -72,7 +72,7 @@ resilient infrastructures.
%prep
%setup -q
%patch1
%patch1 -p0
%build
export STRIP=true