diff --git a/ipvsadm.init b/ipvsadm.init new file mode 100644 index 0000000..f9989ab --- /dev/null +++ b/ipvsadm.init @@ -0,0 +1,74 @@ +#!/bin/sh +# +# Startup script handle the initialisation of LVS +# chkconfig: - 08 92 +# description: Initialise the Linux Virtual Server +# config: /etc/sysconfig/ipvsadm +# +### BEGIN INIT INFO +# Provides: ipvsadm +# Required-Start: $local_fs $network $named +# Required-Stop: $local_fs $remote_fs $network +# Short-Description: Initialise the Linux Virtual Server +# Description: The Linux Virtual Server is a highly scalable and highly +# available server built on a cluster of real servers, with the load +# balancer running on Linux. +### END INIT INFO + +# set the configuration file +IPVSADM_CONFIG="/etc/sysconfig/ipvsadm" + +# Source function library +. /etc/rc.d/init.d/functions + +start() { + # If we don't clear these first, we might be adding to pre-existing rules. + action "Clearing the current IPVS table:" ipvsadm -C + echo -n "Applying IPVS configuration: " + ipvsadm-restore < ${IPVSADM_CONFIG} && \ + success "Applying IPVS configuration" || \ + failure "Applying IPVS configuration" + echo + touch /var/lock/subsys/ipvsadm +} + +stop() { + action "Clearing the current IPVS table:" ipvsadm -C + rm -f /var/lock/subsys/ipvsadm +} + +save() { + echo -n "Saving IPVS table to ${IPVSADM_CONFIG}: " + ipvsadm-save -n > ${IPVSADM_CONFIG} 2>/dev/null && \ + success "Saving IPVS table to ${IPVSADM_CONFIG}" || \ + failure "Saving IPVS table to ${IPVSADM_CONFIG}" + echo +} + +# See how we were called. +case "$1" in + start) + # If we have no configuration, save the current one + [ -f ${IPVSADM_CONFIG} ] || save + start + ;; + stop) + stop + ;; + reload|force-reload|restart) + # Start will flush everything, so it counts as a restart + start + ;; + status) + ipvsadm -L -n + ;; + save) + save + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload|status|save}" + exit 3 +esac + +exit 0 + diff --git a/ipvsadm.spec b/ipvsadm.spec index 462f25e..d61114e 100644 --- a/ipvsadm.spec +++ b/ipvsadm.spec @@ -1,11 +1,12 @@ Summary: Utility to administer the Linux Virtual Server Name: ipvsadm Version: 1.25 -Release: 1 +Release: 2 License: GPLv2+ Group: Applications/System URL: http://www.linuxvirtualserver.org/software/ipvs.html -Source: http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-%{version}.tar.gz +Source0: http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-%{version}.tar.gz +Source1: ipvsadm.init Patch0: ipvsadm-1.24-Makefile.patch Patch1: ipvsadm-1.25-popt.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -26,7 +27,7 @@ offered by the Linux kernel. %build -# Don't use _smp_mflags as it makes to build fail (1.2.4) +# Don't use _smp_mflags as it makes the build fail (1.2.4) CFLAGS="%{optflags}" make @@ -34,6 +35,8 @@ CFLAGS="%{optflags}" make rm -rf %{buildroot} mkdir -p %{buildroot}/etc/rc.d/init.d make install BUILD_ROOT=%{buildroot} MANDIR=%{_mandir} +# Overwrite the provided init script with our own (mostly) LSB compliant one +install -p -m 0755 %{SOURCE1} %{buildroot}/etc/rc.d/init.d/ipvsadm %clean @@ -62,6 +65,9 @@ fi %changelog +* Wed Dec 24 2008 Matthias Saou 1.25-2 +- Fork the included init script to be (mostly) LSB compliant (#246955). + * Mon Dec 22 2008 Matthias Saou 1.25-1 - Prepare update to 1.25 for when devel will update to kernel 2.6.28. - Build require libnl-devel and popt-devel (+ patch to fix popt detection).