File ipvsadm.spec of Package ipvsadm

#
# spec file for package ipvsadm
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           ipvsadm
BuildRequires:  kernel-source popt-devel
BuildRequires:  libnl-devel
Summary:        A Utility for Administering the Linux Virtual Server
Version:        1.26
Release:        1
License:        GPLv2+
Url:            http://www.LinuxVirtualServer.org/
Group:          Productivity/Networking/System
Source0:        http://www.LinuxVirtualServer.org/software/ipvsadm-%{version}.tar.bz2
Source1:        ipvsadm.init
Patch1:         ipvsadm-%{version}.diff
Patch2:         ipvsadm-%{version}-print_largenum.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Provides:       %{name}-%{version}
Requires:       grep
PreReq:         %insserv_prereq %fillup_prereq
%define         prefix   /usr

%description
ipvsadm is a utility for administering the IP virtual server services
offered by the Linux kernel with Linux Virtual Server support.



Authors:
--------
    Wensong Zhang <wensong@iinchina.net>

%prep
%setup
# This files are embedded here instead of being another source in order
# to the prefix directory
cat >sysconfig.ipvsadm <<EOFF
## Path:           Network/IPVS
## Description:    Linux Virtual Server Configuration
## ServiceRestart: ipvsadm
## Type:           string
## Default:        /etc/ipvsadm.rules
# 
# Where to find the IPVSADM config-file
#
IPVSADM_CONFIG="/etc/ipvsadm.rules"
EOFF
cat >ipvsadm.rules <<EOFF
#
# Please insert your ipvs-rules here
#
EOFF
%patch1
%patch2

%build
make POPT_LIB="-lpopt" CFLAGS="${RPM_OPT_FLAGS} -fPIC -DHAVE_POPT -DLIBIPVS_USE_NL"

%install
mkdir -p ${RPM_BUILD_ROOT}/{sbin,usr/sbin,%{_mandir}/man8,etc/init.d,var/adm/fillup-templates}
BUILD_ROOT=${RPM_BUILD_ROOT} MANDIR=%{_mandir} make install
# install SuSE init script
install -m 755 %{S:1}           	${RPM_BUILD_ROOT}/etc/init.d/ipvsadm
ln -sf	../../etc/init.d/ipvsadm	${RPM_BUILD_ROOT}/usr/sbin/rcipvsadm
install -m 644 sysconfig.ipvsadm	${RPM_BUILD_ROOT}/var/adm/fillup-templates/sysconfig.ipvsadm
install -m 644 ipvsadm.rules		${RPM_BUILD_ROOT}/etc/ipvsadm.rules

%post
%{fillup_and_insserv ipvsadm}

%postun
%{insserv_cleanup}

%clean
if [ -n "$RPM_BUILD_ROOT" ] ; then
	[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
fi

%files
%defattr(-,root,root)
%doc README
%config /etc/ipvsadm.rules
/etc/init.d/ipvsadm
/sbin/*
/usr/sbin/*
/%{_mandir}/man*/*
/var/adm/fillup-templates/sysconfig.ipvsadm

%changelog