diff --git a/BackupPC-3.2.1-locatedb.patch b/BackupPC-3.2.1-locatedb.patch new file mode 100644 index 0000000..70978e5 --- /dev/null +++ b/BackupPC-3.2.1-locatedb.patch @@ -0,0 +1,37 @@ +diff -Naur BackupPC-3.2.1-pristine/init.d/src/linux-backuppc BackupPC-3.2.1/init.d/src/linux-backuppc +--- BackupPC-3.2.1-pristine/init.d/src/linux-backuppc 2011-04-24 21:31:55.000000000 -0600 ++++ BackupPC-3.2.1/init.d/src/linux-backuppc 2011-07-07 21:36:41.363281386 -0600 +@@ -20,6 +20,25 @@ + + RETVAL=0 + ++topDirCheck() ++{ ++ updatedb=/etc/updatedb.conf ++ topdir=$(perl <<_EOF_ ++ require '__CONFDIR__/config.pl'; ++ print \$Conf{TopDir}; ++_EOF_ ++) ++ if [ -r $updatedb ]; then ++ grep ^PRUNEPATHS $updatedb | grep ${topdir%%/} > /dev/null ++ if [ $? -eq 1 ]; then ++ logger -t BackupPC -s "WARNING: Your BackupPC \$Conf{TopDir} is not listed in the locate" ++ logger -t BackupPC -s "database configuration's PRUNEPATHS. This may cause all of your" ++ logger -t BackupPC -s "backed up files to be indexed!" ++ fi ++ fi ++} ++ ++ + start() { + # + # You can set the SMB share password here is you wish. Otherwise +@@ -38,6 +57,7 @@ + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/backuppc || \ + RETVAL=1 ++ topDirCheck + return $RETVAL + } + diff --git a/BackupPC-3.2.1-piddir.patch b/BackupPC-3.2.1-piddir.patch new file mode 100644 index 0000000..ed3e56a --- /dev/null +++ b/BackupPC-3.2.1-piddir.patch @@ -0,0 +1,36 @@ +diff -Naur BackupPC-3.2.1-pristine/bin/BackupPC BackupPC-3.2.1/bin/BackupPC +--- BackupPC-3.2.1-pristine/bin/BackupPC 2011-04-24 21:31:54.000000000 -0600 ++++ BackupPC-3.2.1/bin/BackupPC 2011-07-08 21:14:46.609762024 -0600 +@@ -363,11 +363,11 @@ + # Write out our initial status and save our PID + # + StatusWrite(); +- unlink("$LogDir/BackupPC.pid"); +- if ( open(PID, ">", "$LogDir/BackupPC.pid") ) { ++ unlink("/var/run/BackupPC/BackupPC.pid"); ++ if ( open(PID, ">", "/var/run/BackupPC/BackupPC.pid") ) { + print(PID $$); + close(PID); +- chmod(0444, "$LogDir/BackupPC.pid"); ++ chmod(0444, "/var/run/BackupPC/BackupPC.pid"); + } + + # +@@ -1846,7 +1846,7 @@ + close(LOG); + LogFileOpen(); + print(LOG "Fatal error: unhandled signal $SigName\n"); +- unlink("$LogDir/BackupPC.pid"); ++ unlink("/var/run/BackupPC/BackupPC.pid"); + confess("Got new signal $SigName... quitting\n"); + } else { + $SigName = shift; +@@ -1968,7 +1968,7 @@ + } + delete($Info{pid}); + StatusWrite(); +- unlink("$LogDir/BackupPC.pid"); ++ unlink("/var/run/BackupPC/BackupPC.pid"); + exit(1); + } + diff --git a/BackupPC-3.2.1-rundir.patch b/BackupPC-3.2.1-rundir.patch new file mode 100644 index 0000000..79efff1 --- /dev/null +++ b/BackupPC-3.2.1-rundir.patch @@ -0,0 +1,24 @@ +diff -Naur BackupPC-3.2.1-pristine/bin/BackupPC BackupPC-3.2.1/bin/BackupPC +--- BackupPC-3.2.1-pristine/bin/BackupPC 2011-04-24 21:31:54.000000000 -0600 ++++ BackupPC-3.2.1/bin/BackupPC 2011-07-07 22:25:55.287651463 -0600 +@@ -1885,7 +1885,7 @@ + print(LOG $bpc->timeStamp, "unix socket() failed: $!\n"); + exit(1); + } +- my $sockFile = "$LogDir/BackupPC.sock"; ++ my $sockFile = "/var/run/BackupPC/BackupPC.sock"; + unlink($sockFile); + if ( !bind(SERVER_UNIX, sockaddr_un($sockFile)) ) { + print(LOG $bpc->timeStamp, "unix bind() failed: $!\n"); +diff -Naur BackupPC-3.2.1-pristine/lib/BackupPC/Lib.pm BackupPC-3.2.1/lib/BackupPC/Lib.pm +--- BackupPC-3.2.1-pristine/lib/BackupPC/Lib.pm 2011-04-24 21:31:55.000000000 -0600 ++++ BackupPC-3.2.1/lib/BackupPC/Lib.pm 2011-07-07 22:26:46.744614593 -0600 +@@ -686,7 +686,7 @@ + # + # First try the unix-domain socket + # +- my $sockFile = "$bpc->{LogDir}/BackupPC.sock"; ++ my $sockFile = "/var/run/BackupPC/BackupPC.sock"; + socket(*FH, PF_UNIX, SOCK_STREAM, 0) || return "unix socket: $!"; + if ( !connect(*FH, sockaddr_un($sockFile)) ) { + my $err = "unix connect: $!"; diff --git a/BackupPC-TopDir_change.patch b/BackupPC-TopDir_change.patch deleted file mode 100644 index 7500660..0000000 --- a/BackupPC-TopDir_change.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -up BackupPC-3.1.0/lib/BackupPC/Lib.pm.patch BackupPC-3.1.0/lib/BackupPC/Lib.pm ---- BackupPC-3.1.0/lib/BackupPC/Lib.pm.patch 2009-04-10 17:57:04.000000000 +0200 -+++ BackupPC-3.1.0/lib/BackupPC/Lib.pm 2009-04-10 17:57:57.000000000 +0200 -@@ -152,8 +152,6 @@ sub new - # Clean up %ENV and setup other variables. - # - delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; -- $bpc->{PoolDir} = "$bpc->{TopDir}/pool"; -- $bpc->{CPoolDir} = "$bpc->{TopDir}/cpool"; - if ( defined(my $error = $bpc->ConfigRead()) ) { - print(STDERR $error, "\n"); - return; -@@ -167,6 +165,8 @@ sub new - $paths->{$dir} = $bpc->{$dir} = $bpc->{Conf}{$dir}; - } - $bpc->{storage}->setPaths($paths); -+ $bpc->{PoolDir} = "$bpc->{TopDir}/pool"; -+ $bpc->{CPoolDir} = "$bpc->{TopDir}/cpool"; - - # - # Verify we are running as the correct user diff --git a/BackupPC.htaccess b/BackupPC.htaccess index 9e12c90..1538502 100644 --- a/BackupPC.htaccess +++ b/BackupPC.htaccess @@ -9,9 +9,10 @@ order deny,allow deny from all allow from 127.0.0.1 +allow from ::1 AuthType Basic AuthUserFile /etc/BackupPC/apache.users -AuthName "BackupPC +AuthName "BackupPC" require valid-user @@ -20,3 +21,4 @@ require valid-user Alias /BackupPC/images /usr/share/BackupPC/html/ ScriptAlias /BackupPC /usr/share/BackupPC/sbin/BackupPC_Admin +ScriptAlias /backuppc /usr/share/BackupPC/sbin/BackupPC_Admin diff --git a/BackupPC.spec b/BackupPC.spec index fc61adb..15398a2 100644 --- a/BackupPC.spec +++ b/BackupPC.spec @@ -1,50 +1,67 @@ -%if %{?fedora}%{?rhel} >= 5 -%define useselinux 1 -%else -%define useselinux 0 +%if 0%{?rhel} && 0%{?rhel} < 5 +%global _without_selinux 1 +%endif + +%if 0%{?fedora} && 0%{?fedora} > 15 +%global _with_systemd 1 %endif Name: BackupPC -Version: 3.1.0 -Release: 6%{?dist} +Version: 3.2.1 +Release: 1%{?dist} Summary: High-performance backup system Group: Applications/System License: GPLv2+ URL: http://backuppc.sourceforge.net/ Source0: http://downloads.sourceforge.net/backuppc/%{name}-%{version}.tar.gz +Patch0: BackupPC-3.2.1-locatedb.patch +Patch1: BackupPC-3.2.1-rundir.patch +Patch2: BackupPC-3.2.1-piddir.patch Source1: BackupPC.htaccess Source2: BackupPC.logrotate Source3: BackupPC-README.fedora -Patch0: BackupPC-TopDir_change.patch +#A C wrapper to use since perl-suidperl is no longer provided +Source4: BackupPC_Admin.c +Source5: backuppc.service +Source6: BackupPC.tmpfiles + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildArch: noarch -BuildRequires: /bin/cat -BuildRequires: /bin/df -BuildRequires: /bin/gtar -BuildRequires: %{_bindir}/nmblookup +BuildRequires: /bin/cat, /bin/df, /bin/gtar +BuildRequires: %{_bindir}/smbclient, %{_bindir}/nmblookup BuildRequires: %{_bindir}/rsync BuildRequires: %{_sbindir}/sendmail -BuildRequires: %{_bindir}/smbclient BuildRequires: %{_bindir}/split BuildRequires: %{_bindir}/ssh BuildRequires: perl(Compress::Zlib) +%if 0%{?_with_systemd} +BuildRequires: systemd-units +%endif + +# Unbundled libraries +Requires: perl(Net::FTP::AutoReconnect), perl(Net::FTP::RetrHandle) Requires: httpd -Requires: perl-suidperl -Requires: perl(File::RsyncP) -Requires: perl(Compress::Zlib) -Requires: perl(Archive::Zip) -Requires: perl-Time-modules -Requires: perl(XML::RSS) +Requires: perl(File::RsyncP), perl(Compress::Zlib), perl(Archive::Zip) +Requires: perl-Time-modules, perl(XML::RSS) Requires: rsync -Requires: samba-client +# This is a file dependency so EL5 can use samba or samba-client or +# samba3x-client +Requires: %{_bindir}/smbclient, %{_bindir}/nmblookup + Requires(pre): %{_sbindir}/useradd +%if 0%{?_with_systemd} +Requires(preun): systemd-units +Requires(post): systemd-units, %{_sbindir}/usermod +Requires(postun): systemd-units +%else Requires(preun): initscripts, chkconfig Requires(post): initscripts, chkconfig, %{_sbindir}/usermod Requires(postun): initscripts -%if %{useselinux} +%endif + +%if ! 0%{?_without_selinux} Requires: policycoreutils BuildRequires: selinux-policy-devel, checkpolicy %endif @@ -52,21 +69,28 @@ Provides: backuppc = %{version} %description BackupPC is a high-performance, enterprise-grade system for backing up Linux -and WinXX PCs and laptops to a server's disk. BackupPC is highly configurable -and easy to install and maintain. +and WinXX and Mac OS X PCs and laptops to a server's disk. BackupPC is highly +configurable and easy to install and maintain. %prep + %setup -q -%patch0 -p1 + +%patch0 -p1 -b .locatedb +%patch1 -p1 -b .rundir +%patch2 -p1 -b .piddir + sed -i "s|\"backuppc\"|\"$LOGNAME\"|g" configure.pl -iconv -f ISO-8859-1 -t UTF-8 ChangeLog > ChangeLog.utf && mv ChangeLog.utf ChangeLog -pushd doc -iconv -f ISO-8859-1 -t UTF-8 BackupPC.pod > BackupPC.pod.utf && mv BackupPC.pod.utf BackupPC.pod -iconv -f ISO-8859-1 -t UTF-8 BackupPC.html > BackupPC.html.utf && mv BackupPC.html.utf BackupPC.html -popd +for f in ChangeLog doc/BackupPC.pod doc/BackupPC.html; do + iconv -f ISO-8859-1 -t UTF-8 $f > $f.utf && mv $f.utf $f +done + +chmod a-x LICENSE README + cp %{SOURCE3} README.fedora +cp %{SOURCE4} BackupPC_Admin.c -%if %{useselinux} +%if ! 0%{?_without_selinux} %{__mkdir} selinux pushd selinux @@ -82,34 +106,41 @@ require { type ping_exec_t; type sendmail_exec_t; class file getattr; - type httpd_sys_content_t; + type var_run_t; class sock_file getattr; } -allow httpd_t httpd_sys_content_t:sock_file write; +allow httpd_t var_run_t:sock_file write; allow httpd_t initrc_t:unix_stream_socket connectto; allow httpd_t ping_exec_t:file getattr; allow httpd_t sendmail_exec_t:file getattr; allow httpd_t ssh_exec_t:file getattr; -allow httpd_t httpd_sys_content_t:sock_file getattr; +allow httpd_t var_run_t:sock_file getattr; EOF cat >%{name}.fc < 1,|ClientNameAlias => 0,|' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/config.pl -%if %{useselinux} +#perl-suidperl is no longer avaialable, we use a C wrapper +mv $RPM_BUILD_ROOT%{_datadir}/%{name}/sbin/BackupPC_Admin $RPM_BUILD_ROOT%{_datadir}/%{name}/sbin/BackupPC_Admin.pl +install -p BackupPC_Admin $RPM_BUILD_ROOT%{_datadir}/%{name}/sbin/ + +%if ! 0%{?_without_selinux} # SElinux %{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name} %{__install} -m644 selinux/%{name}.pp $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/%{name}.pp @@ -168,12 +213,18 @@ rm -rf $RPM_BUILD_ROOT %preun if [ $1 = 0 ]; then - service backuppc stop > /dev/null 2>&1 || : - chkconfig --del backuppc || : + # Package removal, not upgrade + %if 0%{?_with_systemd} + /bin/systemctl --no-reload disable backuppc.service > /dev/null 2>&1 || : + /bin/systemctl stop backuppc.service > /dev/null 2>&1 || : + %else + service backuppc stop > /dev/null 2>&1 || : + chkconfig --del backuppc || : + %endif fi %post -%if %{useselinux} +%if ! 0%{?_without_selinux} ( # Install/update Selinux policy semodule -i %{_datadir}/selinux/packages/%{name}/%{name}.pp @@ -182,21 +233,49 @@ fi restorecon -R %{_localstatedir}/log/%{name} ) &>/dev/null %endif -chkconfig --add backuppc || : -service httpd condrestart > /dev/null 2>&1 || : -%{_sbindir}/usermod -a -G backuppc apache || : + +if [ $1 -eq 1 ]; then + # initial installation + %if 0%{?_with_systemd} + /bin/systemctl daemon-reload > /dev/null 2>&1 || : + %else + chkconfig --add backuppc || : + service httpd condrestart > /dev/null 2>&1 || : + %endif + %{_sbindir}/usermod -a -G backuppc apache || : +fi +# add BackupPC backup directories to PRUNEPATHS in locate database +UPDATEDB=/etc/updatedb.conf +if [ -w $UPDATEDB ]; then + grep ^PRUNEPATHS $UPDATEDB | grep %{_sharedstatedir}/%{name} > /dev/null + if [ $? -eq 1 ]; then + sed -i '\@PRUNEPATHS@s@"$@ '%{_sharedstatedir}/%{name}'"@' $UPDATEDB + fi +fi + %postun service httpd condrestart > /dev/null 2>&1 || : -%if %{useselinux} +%if ! 0%{?_without_selinux} if [ "$1" -eq "0" ]; then ( # Remove the SElinux policy. semodule -r %{name} || : )&>/dev/null + + # remove BackupPC backup directories from PRUNEPATHS in locate database + if [ -w $UPDATEDB ]; then + sed -i '\@PRUNEPATHS@s@[ ]*'%{_sharedstatedir}/%{name}'@@' $UPDATEDB + fi fi %endif +if [ $1 -ge 1 ]; then + # Package upgrade, not uninstall + %if 0%{?_with_systemd} + /bin/systemctl try-restart backuppc.service > /dev/null 2>&1 || : + %endif +fi %files @@ -213,32 +292,88 @@ fi %dir %{_datadir}/%{name} %dir %{_datadir}/%{name}/sbin %{_datadir}/%{name}/[^s]* -%{_initrddir}/backuppc + +%if 0%{?_with_systemd} +%{_unitdir}/backuppc.service +%config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf +%else +%attr(0755,root,root) %{_initrddir}/backuppc +%dir %attr(0775,backuppc,backuppc) %{_localstatedir}/run/%{name} +%endif %attr(4750,backuppc,apache) %{_datadir}/%{name}/sbin/BackupPC_Admin +%attr(750,backuppc,apache) %{_datadir}/%{name}/sbin/BackupPC_Admin.pl %attr(-,backuppc,root) %{_localstatedir}/lib/%{name}/ -%if %{useselinux} +%if ! 0%{?_without_selinux} %{_datadir}/selinux/packages/%{name}/%{name}.pp %endif %changelog -* Mon May 17 2010 Johan Cwiklinski 3.1.0-6 +* Fri Jul 08 2011 Bernard Johnson - 3.2.1-1 +- v 3.2.1 +- add lower case script URL alias for typing impaired +- cleanup selinux macros +- spec cleanup +- make samba dependency on actual files required to EL5 can use samba-client + or samba3x-client (bz #667479) +- unbundle perl(Net::FTP::AutoReconnect) and perl(Net::FTP::RetrHandle) +- remove old patch that is no longer needed +- attempt to make sure $Conf{TopDir} is listed in updatedb PRUNEPATHS, + otherwise at least generate a warning on statup (bz #554491) +- move sockets to /var/run (bz #719499) +- add support for systemd starting at F16 (bz #699441) +- patch to move pid dir under /var/run +- unbundle Net::FTP::* +- add support for tmpfiles.d + +* Mon Feb 07 2011 Fedora Release Engineering - 3.1.0-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Aug 02 2010 Johan Cwiklinski 3.1.0-16 +- Debugingo with no sources (fix bug #620257) + +* Sat Jul 31 2010 Johan Cwiklinski 3.1.0-15 +- perl-suidperl is no longer available (fix bug #611009) + +* Fri Jul 09 2010 Mike McGrath 3.1.0-14.1 +- Rebuilding to fix perl-suidperl broken dep + +* Mon May 17 2010 Johan Cwiklinski 3.1.0-14 - Fix for bug #592762 -* Sun Jan 17 2010 Johan Cwiklinski 3.1.0-5 +* Sun Feb 28 2010 Johan Cwiklinski 3.1.0-12 +- Add "::1" to the apache config file for default allowed adresses +- Fix a typo in the apache config file + +* Sun Jan 17 2010 Johan Cwiklinski 3.1.0-11 - Really fix selinux labelling backup directory (bug #525948) -* Fri Jan 15 2010 Johan Cwiklinski 3.1.0-4 +* Fri Jan 15 2010 Johan Cwiklinski 3.1.0-10 - Fix selinux labelling backup directory (bug #525948) + +* Fri Sep 25 2009 Johan Cwiklinski 3.1.0-9 - Fix security bug (bug #518412) + +* Wed Sep 23 2009 Johan Cwiklinski 3.1.0-8 +- Rebuild with latest SELinux policy (bug #524630) + +* Fri Sep 18 2009 Johan Cwiklinski 3.1.0-7 - Fix SELinux policy module for UserEmailInfo.pl file -* Fri Apr 10 2009 Johan Cwiklinski 3.1.0-3 +* Fri Jul 24 2009 Fedora Release Engineering - 3.1.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Fri Apr 10 2009 Johan Cwiklinski 3.1.0-5 - Fix TopDir change (bug #473944) -* Sat Aug 23 2008 Johan Cwiklinski 3.1.0-2 +* Mon Feb 23 2009 Fedora Release Engineering - 3.1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Aug 11 2008 Johan Cwiklinski 3.1.0-3 - using /dev/null with SELinux policy to avoid broken pipe errors (bug #432149) + +* Sat Apr 05 2008 Johan Cwiklinski 3.1.0-2 - correcting nologin path * Thu Nov 29 2007 Johan Cwiklinski 3.1.0-1 diff --git a/BackupPC.tmpfiles b/BackupPC.tmpfiles new file mode 100644 index 0000000..9d940cc --- /dev/null +++ b/BackupPC.tmpfiles @@ -0,0 +1 @@ +D /var/run/BackupPC backukppc backuppc 775 - diff --git a/BackupPC_Admin.c b/BackupPC_Admin.c new file mode 100644 index 0000000..be3137f --- /dev/null +++ b/BackupPC_Admin.c @@ -0,0 +1,10 @@ +#include +#ifndef REAL_PATH +#define REAL_PATH "/usr/share/BackupPC/sbin/BackupPC_Admin.pl" +#endif +int main(ac, av) +char **av; +{ + execv(REAL_PATH, av); + return 0; +} diff --git a/backuppc.service b/backuppc.service new file mode 100644 index 0000000..d9f32c9 --- /dev/null +++ b/backuppc.service @@ -0,0 +1,13 @@ +[Unit] +Description= BackupPC server +After=syslog.target + +[Service] +Type=oneshot +User=backuppc +Group=backuppc +ExecStart=/usr/share/BackupPC/bin/BackupPC -d +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/sources b/sources index 91ff97a..cb0804f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -84b4471852ef910768eae9963ef932d2 BackupPC-3.1.0.tar.gz +2334fafb8e03284225a9b8a7fb230012 BackupPC-3.2.1.tar.gz