--- /dev/null
+Summary: Local Unified Index (Solr)
+Name: masterkey-lui-solr
+Version: 0.1.0
+Release: 1.indexdata
+License: IndexData
+Group: Applications/Internet
+Vendor: Index Data ApS <info@indexdata.dk>
+Source: masterkey-lui-%{version}.tar.gz
+BuildArch: noarch
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+Packager: Dennis Schafroth <dennis@indexdata.com>
+URL: http://www.indexdata.dk/masterkey
+
+%description
+The Local Unified Index is a index that can have subdatabase. The underlying index is a Solr/lucene index configured to use a specific LUI schema.
+
+%package -n masterkey-lui-tomcat
+Summary: Harvester Admin
+Requires: masterkey-lui-solr
+Group: Applications/Internet
+
+%package -n masterkey-lui-tomcat6
+Summary: Harvester Admin Tomcat 6 integration
+Requires: tomcat6 masterkey-lui-tomcat
+Group: Applications/Internet
+
+
+%description -n masterkey-lui
+The LUI is the stand-alone Solr/Lucene Index with the LUI schema
+
+%description -n masterkey-lui-tomcat
+The LUI Tomcat is part of the MasterKey suite. This package provides the LUI Tomcat context
+
+%description -n masterkey-lui-tomcat6
+The LUI is part of the MasterKey suite. This package provides Tomcat 6 integration.
+
+%prep
+%setup
+%build
+
+%define lui-solr dist/
+%define lui-config schema/
+%define lui-data data/
+
+%install
+mkdir -p ${RPM_BUILD_ROOT}/%{_datadir}/masterkey/lui/war
+cp -a %{lui-solr}/* ${RPM_BUILD_ROOT}/%{_datadir}/masterkey/lui/solr/war
+cp -a %{lui-solr}/* ${RPM_BUILD_ROOT}/%{_datadir}/masterkey/lui/solr/conf
+
+mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/masterkey/harvester/
+# cp -a etc/harvester.properties ${RPM_BUILD_ROOT}/%{_sysconfdir}/masterkey/harvester/
+
+mkdir -p ${RPM_BUILD_ROOT}/%{_localstatedir}/log/masterkey/harvester
+
+#tomcat context
+sed -e 's@docBase=".*"@docBase="%{_datadir}\/masterkey\/harvester"@g' etc/harvester-context.xml > ${RPM_BUILD_ROOT}/%{_sysconfdir}/masterkey/harvester/harvester-context.xml
+
+mkdir -p ${RPM_BUILD_ROOT}/%{_datadir}/masterkey/harvester-admin/
+cp -a %{admin}/* ${RPM_BUILD_ROOT}/%{_datadir}/masterkey/harvester-admin/
+
+mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/masterkey/harvester-admin/
+#cp -a etc/harvester.properties ${RPM_BUILD_ROOT}/%{_sysconfdir}/masterkey/harvester-admin/
+
+mkdir -p ${RPM_BUILD_ROOT}/%{_localstatedir}/log/masterkey/harvester-admin
+
+#tomcat context
+sed -e 's@docBase=".*"@docBase="%{_datadir}\/masterkey\/harvester"@g' etc/harvester-admin-context.xml > ${RPM_BUILD_ROOT}/%{_sysconfdir}/masterkey/harvester-admin/harvester-admin-context.xml
+
+
+%clean
+rm -fr ${RPM_BUILD_ROOT}
+
+%post -n masterkey-harvester-tomcat5
+ln -sf %{_sysconfdir}/masterkey/harvester/harvester-context.xml %{_sysconfdir}/tomcat5/Catalina/localhost/harvester.xml
+
+%postun -n masterkey-harvester-tomcat5
+if [ $1 = 0 ]; then
+ rm -f %{_sysconfdir}/tomcat5/Catalina/localhost/harvester.xml
+fi
+
+%post -n masterkey-harvester-admin-tomcat5
+ln -sf %{_sysconfdir}/masterkey/harvester-admin/harvester-admin-context.xml %{_sysconfdir}/tomcat5/Catalina/localhost/harvester-admin.xml
+
+%postun -n masterkey-harvester-admin-tomcat5
+if [ $1 = 0 ]; then
+ rm -f %{_sysconfdir}/tomcat5/Catalina/localhost/harvester-admin.xml
+fi
+
+%post -n masterkey-harvester-tomcat6
+ln -sf %{_sysconfdir}/masterkey/harvester/harvester-context.xml %{_sysconfdir}/tomcat6/Catalina/localhost/harvester.xml
+
+%postun -n masterkey-harvester-tomcat6
+if [ $1 = 0 ]; then
+ rm -f %{_sysconfdir}/tomcat6/Catalina/localhost/harvester.xml
+fi
+
+%post -n masterkey-harvester-admin-tomcat6
+ln -sf %{_sysconfdir}/masterkey/harvester-admin/harvester-admin-context.xml %{_sysconfdir}/tomcat6/Catalina/localhost/harvester-admin.xml
+
+%files
+%defattr(-,root,root)
+%{_datadir}/masterkey/harvester
+%attr(750,indexdata,indexdata) %dir %{_localstatedir}/lib/masterkey/lui/
+
+%files -n masterkey-lui-tomcat
+%defattr(-,root,root)
+%config %{_sysconfdir}/masterkey/lui/lui-context.xml
+
+%files -n masterkey-harvester-tomcat5
+%files -n masterkey-harvester-admin-tomcat5
+%files -n masterkey-harvester-tomcat6
+%files -n masterkey-harvester-admin-tomcat6