File cntlm.spec of Package cntlm

#
# spec file for package cntlm (Version 0.35.1)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2007 Scorpio IT, Deidesheim, 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:           cntlm
Summary:        Fast NTLM authentication proxy with tunneling
Version:        0.35.1
Release:        1
License:        GNU GPL V2
Group:          Productivity/Networking/Web/Proxy
Url:            http://cntlm.sourceforge.net/
Source0:        %{name}-%{version}.tar.bz2
Source1:        %{name}.init
Source2:        %{name}.sysconfig
Patch:          %{name}-0.35.1-config.patch
Patch1:         %{name}-0.35.1-Makefile.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         pwdutils grep

%description
Cntlm is a fast and efficient NTLM proxy, with support for TCP/IP tunneling,
authenticated connection caching, ACLs, proper daemon logging and behaviour
and much more. It has up to ten times faster responses than similar NTLM
proxies, while using by orders or magnitude less RAM and CPU. Manual page 
contains detailed information.

  Contact:	David Kubicek <dave@awk.cz>


%prep
%setup -q -n %{name}-%{version}
%patch -p1
%patch1 -p1

%build			
./configure
%{__make} SYSCONFDIR=%{_sysconfdir} \
	BINDIR=%{_sbindir} \
	MANDIR=%{_mandir}

%install
%makeinstall SYSCONFDIR=$RPM_BUILD_ROOT/%{_sysconfdir} \
	BINDIR=$RPM_BUILD_ROOT/%{_sbindir} \
	MANDIR=$RPM_BUILD_ROOT/%{_mandir}
%{__install} -d $RPM_BUILD_ROOT/var/run/%{name}
%{__install} -D -m 755 %{S:1} $RPM_BUILD_ROOT/%{_initrddir}/%{name}
%{__ln_s} -f ../..%{_sysconfdir}/init.d/%{name} ${RPM_BUILD_ROOT}/usr/sbin/rc%{name}
%{__install} -D -m 644 %{S:2} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.%{name}

%pre
# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
  # user cntlm
  if [ -z  "`%{_bindir}/getent passwd "%{name}"`" ]; then
    %{_sbindir}/useradd -c "CNTLM Proxy Auth" -d /var/run/%{name} -g nogroup \
	-r -s /bin/false %{name} 2>/dev/null;
  fi

%preun
# on `rpm -e` PARAM is 0
%stop_on_removal cntlm
#if [ "$1" -eq 0 ]; then
#  %{_sbindir}/userdel %{name} 2>/dev/null
#fi

%post
# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
%{fillup_and_insserv cntlm}

%postun
# on `rpm -e` PARAM is 0
%restart_on_update cntlm
%{insserv_cleanup}

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && %{__rm} -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc COPYRIGHT LICENSE README VERSION
%config(noreplace) %{_sysconfdir}/%{name}.conf
%config(noreplace) %{_initrddir}/%{name}
%{_sbindir}/*
%{_mandir}/man1/%{name}.1*
%dir %attr(755,%{name},root) /var/run/%{name}
/var/adm/fillup-templates/sysconfig.%{name}

%changelog