+# TODO:
+# - make it simply build...
+# - make pre/post for apache
+# - add all needed files to %files
%include /usr/lib/rpm/macros.perl
Summary: A high-performance, enterprise-grade system for backing up PCs
Summary(pl): Wysoko wydajny, profesjonalnej klasy system do kopii zapasowych z PC
Name: backuppc
-Version: 2.0.2
-Release: 2
+Version: 2.1.0
+Release: 0.5
License: GPL
Group: Networking/Utilities
Source0: http://dl.sourceforge.net/backuppc/BackupPC-%{version}.tar.gz
-# Source0-md5: d60aacbf46eb83a7e4ffbbe9e4f72c11
-Patch0: %{name}-debian.patch
+# Source0-md5: 4e201f00842c88cf241e0429643c6ec4
+Patch0: %{name}-usernotexist.patch
URL: http://backuppc.sourceforge.net/
-BuildRequires: fakeroot
+#BuildRequires: fakeroot
+BuildRequires: perl-base
BuildRequires: perl-devel >= 1:5.6.0
BuildRequires: perl-Compress-Zlib
BuildRequires: perl-Digest-MD5
+Requires: samba-client
+# lets check if it's really needed
+#Requires: sperl
Requires: tar > 1.13
-Requires: samba-clients
-Requires: sperl
Requires: webserver
Obsoletes: BackupPC
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+%define _backuppcdir %{_datadir}/%{name}
+
%description
BackupPC is disk based and not tape based. This particularity allows
features not found in any other backup solution:
%setup -q -n BackupPC-%{version}
%patch0 -p1
+%build
+sed -i -e 's#!/bin/perl#!%{__perl}#' configure.pl
+sed -i -e 's#!/bin/perl#!%{__perl}#' {bin,cgi-bin,doc}/*
+sed -i -e 's#!/bin/perl#!%{__perl}#' */src/*
+sed -i -e 's#!/bin/perl#!%{__perl}#' */*/*/*.pm
+
+pod2man --section=8 --center="BackupPC manual" doc/BackupPC.pod backuppc.8
+perl -e "s/.IX Title.*/.SH NAME\nbackuppc \\- BackupPC manual/g" -p -i.tmp backuppc.8
+
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,backuppc,httpd/httpd.conf} \
- $RPM_BUILD_ROOT/var/lib/backuppc/pc/localhost
+install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,%{name},httpd/httpd.conf} \
+ $RPM_BUILD_ROOT%{_var}/lib/%{name}/pc/localhost
-echo "y" | \
-fakeroot DEBIANDEST=$RPM_BUILD_ROOT %{__perl} configure.pl
+# Does not work, yet... some voodoo-magic is needed
+#echo "y" | fakeroot DEBIANDEST=$RPM_BUILD_ROOT configure.pl
+%{__perl} configure.pl \
+ --batch \
+ --bin-path perl=%{__perl} \
+ --bin-path tar=/bin/tar \
+ --bin-path smbclient=%{_bindir}/smbclient \
+ --bin-path nmblookup=%{_bindir}/nmblookup \
+ --bin-path rsync=%{_bindir}/rsync \
+ --bin-path ping=/bin/ping \
+ --bin-path df=/bin/df \
+ --bin-path ssh=%{_bindir}/ssh \
+ --bin-path sendmail=%{_sbindir}/sendmail \
+ --bin-path hostname=/bin/hostname \
+ --bin-path split=%{_bindir}/split \
+ --bin-path cat=/bin/cat \
+ --bin-path gzip=/bin/gzip \
+ --bin-path bzip2=%{_bindir}/bzip2 \
+ --cgi-dir %{_datadir}/BackupPC/cgi-bin \
+ --data-dir %{_var}/lib/BackupPC \
+ --dest-dir $RPM_BUILD_ROOT \
+ --hostname localhost \
+ --html-dir %{_usr}/share/BackupPC/www/html \
+ --html-dir-url /BackupPC \
+ --install-dir %{_usr} \
+ --uid-ignore
+# --config-path %{_sysconfdir}/backuppc \
-pod2man --section=8 --center="BackupPC manual" doc/BackupPC.pod backuppc.8
-perl -e "s/.IX Title.*/.SH NAME\nbackuppc \\- BackupPC manual/g" -p -i.tmp backuppc.8
-rm -f $RPM_BUILD_ROOT%{_datadir}/backuppc/doc/*
-mv -f $RPM_BUILD_ROOT/var/lib/backuppc/conf/* $RPM_BUILD_ROOT%{_sysconfdir}/backuppc
-mv -f $RPM_BUILD_ROOT%{_datadir}/backuppc/cgi-bin/* $RPM_BUILD_ROOT%{_datadir}/backuppc/cgi-bin/index.cgi
-install --mode=644 conf/hosts $RPM_BUILD_ROOT%{_sysconfdir}/backuppc
-install --mode=644 debian/localhost.pl $RPM_BUILD_ROOT%{_sysconfdir}/backuppc
-install --mode=644 debian/apache.conf $RPM_BUILD_ROOT%{_sysconfdir}/httpd/httpd.conf/93_backuppc.conf
-rmdir $RPM_BUILD_ROOT/var/lib/backuppc/conf
+#mv -f $RPM_BUILD_ROOT/var/lib/backuppc/conf/* $RPM_BUILD_ROOT%{_sysconfdir}/backuppc
+#mv -f $RPM_BUILD_ROOT%{_datadir}/backuppc/cgi-bin/BackupPC_Admin $RPM_BUILD_ROOT%{_datadir}/backuppc/cgi-bin/index.cgi
+#install conf/hosts $RPM_BUILD_ROOT%{_sysconfdir}/backuppc
+#install debian/localhost.pl $RPM_BUILD_ROOT%{_sysconfdir}/backuppc
+#install debian/apache.conf $RPM_BUILD_ROOT%{_sysconfdir}/httpd/httpd.conf/93_backuppc.conf
+
+# Cleanups:
+#rm -f $RPM_BUILD_ROOT%{_datadir}/backuppc/doc/*
+#rmdir $RPM_BUILD_ROOT/var/lib/backuppc/conf
-cd $RPM_BUILD_ROOT%{_datadir}/backuppc/cgi-bin
-ln -s ../image
+# Linking cgi:
+#cd $RPM_BUILD_ROOT%{_datadir}/backuppc/cgi-bin
+#ln -s ../image
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
%doc doc/*.html
-%attr(750,root,root) %dir %{_sysconfdir}/backuppc
-%config(noreplace) %verify(not md5 size mtime) %attr(640,root,root) %{_sysconfdir}/backuppc/*
-%attr(755,root,root) %{_bindir}/*
+#%attr(750,root,root) %dir %{_sysconfdir}/backuppc
+#%config(noreplace) %verify(not md5 size mtime) %attr(640,root,root) %{_sysconfdir}/backuppc/*
+#%config(noreplace) %verify(not md5 size mtime) %attr(640,root,root) %{_sysconfdir}/httpd/httpd.conf/93_backuppc.conf
+#%attr(755,root,root) %{_bindir}/*
%attr(750,root,root) %dir %{_var}/lib/backuppc
-%{_mandir}/man?/*