Summary: Web Application for centralized Package and Patch Management
Name: dasspackagemanager
Version: @@@VERSION@@@
Release: 1%{?dist}
License: Apache
Group: other
BuildArch: noarch
URL: http://www.dass-it.de/PackageManager

Source: %{name}_%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

BuildRequires: java-devel >= 1.6
BuildRequires: postgresql-jdbc
BuildRequires: tomcat6
BuildRequires: ant
Requires: java >= 1.6
Requires: postgresql
Requires: tomcat6
Requires: cron
Requires: python
Requires: python-httplib2
Requires: python-psycopg2
%define webapps /srv/tomcat6/webapps
%description
PackageManager is a web application for centralized package and patch management
using a configuration management like puppet to perform package installation and
upgrading.

%prep
%setup -n PackageManager

%build
ant jar
%install
export NO_BRP_CHECK_BYTECODE_VERSION=true

mkdir -p "%{buildroot}%{webapps}"
mkdir -p "%{buildroot}/usr/sbin"
mkdir -p "%{buildroot}/etc/cron.d"
mkdir -p "%{buildroot}/etc/init.d"
ant install -Dinstallprefix="%{buildroot}%{webapps}/PackageManager"
mv %{buildroot}%{webapps}/PackageManager/WEB-INF/tools.xml.dist %{buildroot}%{webapps}/PackageManager/WEB-INF/tools.xml
mv %{buildroot}%{webapps}/PackageManager/WEB-INF/web.xml.dist %{buildroot}%{webapps}/PackageManager/WEB-INF/web.xml
install -m 755 scripts/packagemanager %{buildroot}/usr/sbin
install -m 755 scripts/packagemanager-watchdb %{buildroot}/usr/sbin
install -m 755 scripts/update-packagelists-puppet %{buildroot}/usr/sbin
install -m 755 scripts/update-packagelists %{buildroot}/usr/sbin
install -m 755 scripts/packagemanager-reports %{buildroot}/usr/sbin
install -m 644 scripts/packagemanager.cron %{buildroot}/etc/cron.d/dasspackagemanager
install -m 644 scripts/packagemanager-init-list %{buildroot}/usr/sbin
install -m 755 debian/dasspackagemanager.init %{buildroot}/etc/init.d/dasspackagemanager

%clean
%{__rm} -rf %{buildroot}

%postun
%insserv_cleanup
%preun
%stop_on_removal

%files
%defattr(-,root,root)
%attr(0640,root,tomcat ) %config %{webapps}/PackageManager/WEB-INF/tools.xml
%config %{webapps}/PackageManager/WEB-INF/web.xml
%config /etc/cron.d/dasspackagemanager
%config /etc/init.d/dasspackagemanager
%{webapps}/PackageManager
/usr/sbin/packagemanager
/usr/sbin/packagemanager-watchdb
/usr/sbin/packagemanager-init-list
/usr/sbin/update-packagelists-puppet
/usr/sbin/update-packagelists
/usr/sbin/packagemanager-reports
%dir /srv/tomcat6
%dir /srv/tomcat6/webapps
%changelog
* Thu Feb 21 2013 Sebastian Lederer slederer@dass-it.de 1.0
  - first attempt at an RPM package
