#
# $Id$
#

Summary:        dploy.org DHCP interface tools
Summary(fr):    Outils d'interface DHCP pour dploy.org

Name:           PBPKG
Version:        PBVER
Release:        PBTAGPBSUF
License:        GPL
Group:          PBGRP
Url:            PBURL
Source:         PBSRC
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
BuildArch:		noarch
Requires:       dploy-common, sudo, perl, PBDEP

%description
PBDESC

%description -l fr
Outils d'interface DHCP pour dploy.org

%prep
%setup -q

%install
%{__rm} -rf $RPM_BUILD_ROOT
export DESTDIR=$RPM_BUILD_ROOT
export PREFIX=%{_exec_prefix} 
export CONFDIR=%{_sysconfdir}/PBPROJ
./install.sh

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc ChangeLog
#%doc INSTALL COPYING README AUTHORS NEWS
%{_bindir}/*

%post
# Include our configuration file in std dhcp.conf file
#grep -qE '^include "%{_sysconfdir}/PBPROJ/dhcpd.conf";' /etc/dhcpd.conf
#if [ $? -ne 0 ]; then
	#echo 'include "%{_sysconfdir}/PBPROJ/dhcpd.conf";' >> /etc/dhcpd.conf
#fi

# Give us the rights to modify the DHCP conf file
chgrp dploy %{_sysconfdir}/dhcpd.conf
chmod 664 %{_sysconfdir}/dhcpd.conf

# Include dploy in sudoers
grep -qE '^dploy ' %{_sysconfdir}/sudoers | grep %{_sysconfdir}/init.d/dhcpd
if [ $? -ne 0 ]; then
	echo 'dploy ALL=NOPASSWD: /etc/init.d/dhcpd ?*' >> %{_sysconfdir}/sudoers
fi

%changelog
PBLOG
