Sophie

Sophie

distrib > Mageia > 6 > i586 > by-pkgid > 145ff66690e21355c5a092e890a23686 > files > 6

backuppc-3.3.2-1.mga6.src.rpm

%define debug_package %{nil}

%global __provides_exclude perl\\(BackupPC::.*\\)
%global __requires_exclude perl\\(BackupPC::.*\\)

%define upstream_name BackupPC

Name:               backuppc
Version:            3.3.2
Release:            %mkrel 1
Summary:            High-performance, enterprise-grade backup system
Group:              Archiving/Backup
License:            GPLv2
Url:                http://backuppc.sourceforge.net
Source:             http://sourceforge.net/projects/backuppc/files/backuppc/%version/%{upstream_name}-%{version}.tar.gz
Source2:            %{name}.init
Source3:            BackupPC_Admin.c
Source4:            backuppc.service
Source5:            backuppc.tmpfiles
Patch0:             %{name}-3.1.0-fhs.patch
Requires:           sendmail-command
Requires:           apache
Requires(post):     systemd >= %{systemd_required_version}
Requires(post):     rpm-helper >= 0.24.8-1
Requires(preun):    rpm-helper >= 0.24.8-1
Recommends:         openssh-clients
Recommends:         samba-client
Recommends:         perl(File::RsyncP)

%description
BackupPC is a high-performance, enterprise-grade system
for backing up Linux, Win32, and laptops to a server's disk.
Features include clever pooling of identical files, no client-side
software, and a powerful Apache/CGI user interface.

%prep
%setup -q -n %{upstream_name}-%{version}
%patch0 -p1

rm -rf images/CVS
# fix file perms
find lib -type f -exec chmod 644 {} \;
find bin -type f -exec chmod 755 {} \;
find doc -type f -exec chmod 644 {} \;
find . -maxdepth 1 -type f -exec chmod 644 {} \;
# fix perl shellbang
find . -type f -exec perl -pi -e 's|^#!/bin/perl|#!/usr/bin/perl|' {} \;

%build
gcc %SOURCE3 -o BackupPC_Admin
# set installation directory
find . -type f -exec perl -pi -e 's|__INSTALLDIR__|%{_datadir}/%{name}|' {} \;
find . -type f -exec perl -pi -e 's|__TOPDIR__|%{_localstatedir}/lib/%{name}|' {} \;
# set configuration
# the binaries path are disabled to avoid service failure at start
perl -pi \
    -e 's|^\$Conf{BackupPCUser}.*|\$Conf{BackupPCUser} = "%{name}";|;' \
    -e 's|^\$Conf{CgiDir}.*|\$Conf{CgiDir} = "%{_var}/www/%{name}";|;' \
    -e 's|^\$Conf{InstallDir}.*|\$Conf{InstallDir} = "%{_datadir}/%{name}";|;' \
    -e 's|^\$Conf{CgiImageDirURL}.*|\$Conf{CgiImageDirURL} = "/%{name}";|;' \
    -e 's|^\$Conf{SshPath}.*|\$Conf{SshPath} = "/usr/bin/ssh";|;' \
    -e 's|^\$Conf{SmbClientPath}.*|\$Conf{SmbClientPath} = "/usr/bin/smbclient";|;' \
    -e 's|^\$Conf{NmbLookupPath}.*|\$Conf{NmbLookupPath} = "/usr/bin/nmblookup";|;' \
    -e 's|^\$Conf{PingPath}.*|\$Conf{PingPath} = "/bin/ping";|;' \
    -e 's|^\$Conf{DfPath}.*|\$Conf{DfPath} = "/bin/df";|;' \
    -e 's|^\$Conf{SplitPath}.*|\$Conf{SplitPath} = "/usr/bin/split";|;' \
    -e 's|^\$Conf{CatPath}.*|\$Conf{CatPath} = "/bin/cat";|;' \
    -e 's|^\$Conf{GzipPath}.*|\$Conf{GzipPath} = "/bin/gzip";|;' \
    -e 's|^\$Conf{Bzip2Path}.*|\$Conf{Bzip2Path} = "/usr/bin/bzip2";|;' \
    -e 's|^\$Conf{SendmailPath}.*|\$Conf{SendmailPath} = "/usr/sbin/sendmail";|;' \
    -e 's|^\$Conf{ServerInitdPath}.*|\$Conf{ServerInitdPath} = "%{_initrddir}/%{name}";|;' \
    -e 's|^\$Conf{BackupPCdPath}.*|\$Conf{BackupPCdPath} = "%{_datadir}/%{name}/bin/BackupPC";|;' \
    -e 's|^\$Conf{TarClientPath}.*|\$Conf{TarClientPath} = "/bin/tar";|;' \
    -e 's|^\$Conf{RsyncClientPath}.*|\$Conf{RsyncClientPath} = "/usr/bin/rsync";|;' \
    -e 's|^\$Conf{TopDir}.*|\$Conf{TopDir} = "/var/lib/backuppc";|;' \
    conf/config.pl

%install
# constant files
install -d -m 755 %{buildroot}%{_datadir}/%{name}
cp -pr lib %{buildroot}%{_datadir}/%{name}
cp -pr bin %{buildroot}%{_datadir}/%{name}
cp -pr doc %{buildroot}%{_datadir}/%{name}

# web files
install -d -m 755 %{buildroot}%{_var}/www/%{name}
install -m 644 images/* %{buildroot}%{_var}/www/%{name}
install -m 644 conf/*.css %{buildroot}%{_var}/www/%{name}
install -m 644 conf/*.js %{buildroot}%{_var}/www/%{name}
install -m 755 cgi-bin/BackupPC_Admin %{buildroot}%{_var}/www/%{name}/BackupPC_Admin.cgi

# variable files
install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name}
install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name}/{cpool,log,pc,pool,trash}

# perl-suidperl is no longer avaialable, use a C wrapper
install -m 4755 BackupPC_Admin %{buildroot}%{_var}/www/%{name}

# configuration
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}
install -m 644 conf/{hosts,config.pl} %{buildroot}%{_sysconfdir}/%{name}

# init script
install -d -m 755 %{buildroot}%{_initrddir}
install -m 755 %{SOURCE2} %{buildroot}%{_initrddir}/%{name}

# systemd
install -m 644 -D %{SOURCE4} %{buildroot}%{_unitdir}/%{name}.service
install -m 644 -D %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf

# logs
install -d -m 755 %{buildroot}%{_var}/log/%{name}

# apache configuration
install -d -m 755 %{buildroot}%{_webappconfdir}
cat > %{buildroot}%{_webappconfdir}/%{name}.conf <<EOF
# BackupPC Apache configuration
Alias /%{name} %{_var}/www/%{name}

<Directory %{_var}/www/%{name}>
    Require all granted
    Options ExecCGI
    <Files BackupPC_Admin>
        SetHandler cgi-script
    </Files>
    DirectoryIndex BackupPC_Admin
</Directory>
EOF

cat > README.mga <<EOF
Mageia RPM specific notes

Setup
-----
The Mageia setup improves the FHS compliance wrt. that used upstream:
- /var/www/backuppc    ... files accessible from the web
- /usr/share/backuppc  ... files non-accessible from the web
- /var/lib/backuppc    ... files with varibales
- /etc/backuppc        ... both global and per-host configuration files

Backuppc user; backup-data
--------------------------
Backup-data stored in another file-system can be made accessible to backuppc
by creating a soft link from /var/www/lib to the root of the backup-data
hierarchy. If backuppc is uninstalled (urpme backuppc), this data will not
be deleted - with the exception of a cpool directory that is empty; when,
subsequently, backuppc is newly installed, cpool must be manually created
(with uid:gid = backuppc:backkuppc).

To make backuppc access backup-data that exist prior to installing backkuppc,
make sure that the user "backuppc" exists BEFORE the package is installed, and
that its uid and gid matches the ownership of that data (otherwise the
package would automatically create the user with random uid and gid values).

Lighttpd server definition
--------------------------
When using lighttpd, the following definition in /etc/lighttpd/lighttpd.conf
should work:
    $HTTP["url"] =~ "^/backuppc" {
        server.document-root = "/var/www/backuppc"
        cgi.assign = ( "BackupPC_Admin" => "" )
        index-file.names = ( "BackupPC_Admin" )
        alias.url = ( "/backuppc" => "/var/www/backuppc" )
        dir-listing.activate = "disable"
        $HTTP["remoteip"] != "127.0.0.1" {
            auth.backend = "htpasswd"
            auth.backend.htpasswd.userfile = "<password-dir>/passwd/backuppc"
            auth.require += ( "" => (   "method" => "basic",
                                        "realm" => "BackupPC",
                                        "require" => "valid-user" ) )
        }
    }
<password-dir> is the directory where you keep the passwords for your server;
the suggested definition does not require authentication if the backuppc gui
is invoked from the machine that hosts the lighttpd server
EOF

%pre
%_pre_useradd %{name} %{_localstatedir}/lib/%{name} /bin/sh

%post
%_tmpfilescreate %{name}
%_post_service %{name}

%preun
%_preun_service %{name}
if [ $1 -ne 0 ] ; then
# previous releases of backuppc had root as the owner - undo this fault
  chown backuppc:backuppc %{_sysconfdir}/%{name}
fi

%postun
%_postun_userdel %{name}

%files
%doc ChangeLog README LICENSE doc/* README.mga
# backuppc must be able to edit the config file and create backup files
%config(noreplace) %attr(0755,backuppc,backuppc) %{_sysconfdir}/%{name}
%config(noreplace) %attr(0640,backuppc,backuppc) %{_sysconfdir}/%{name}/*
%config(noreplace) %{_webappconfdir}/%{name}.conf
%{_initrddir}/%{name}
%{_unitdir}/%{name}.service
%{_tmpfilesdir}/%{name}.conf
%{_datadir}/%{name}
#note: globbings like [^B]* or !(BackupPC*) don't work
%{_var}/www/%{name}/*.gif
%{_var}/www/%{name}/*.png
%{_var}/www/%{name}/*.css
%{_var}/www/%{name}/*.js
%{_var}/www/%{name}/*.ico
%attr(-,backuppc,backuppc) %{_var}/www/%{name}/BackupPC_Admin.cgi
%attr(-,backuppc,backuppc) %{_var}/www/%{name}/BackupPC_Admin
%attr(-,backuppc,backuppc) %{_var}/log/%{name}
%attr(-,backuppc,backuppc) %{_localstatedir}/lib/%{name}


%changelog
* Sun Feb 05 2017 shlomif <shlomif> 3.3.2-1.mga6
+ Revision: 1084862
- New version 3.3.2 that should include fix for MGA#18251 .

* Wed Feb 10 2016 umeabot <umeabot> 3.3.1-2.mga6
+ Revision: 953244
- Mageia 6 Mass Rebuild

* Sun Aug 16 2015 ycantin <ycantin> 3.3.1-1.mga6
+ Revision: 865155
- fix more spec formatting
- fix spec formatting
- new version 3.3.1

* Wed Oct 15 2014 umeabot <umeabot> 3.3.0-5.mga5
+ Revision: 745447
- Second Mageia 5 Mass Rebuild

* Tue Sep 16 2014 umeabot <umeabot> 3.3.0-4.mga5
+ Revision: 678099
- Mageia 5 Mass Rebuild

  + tv <tv>
    - use %%global for req/prov exclude
    - autoconvert to new prov/req excludes
    - s/uggests:/Recommends:/

* Sat Jul 12 2014 doktor5000 <doktor5000> 3.3.0-3.mga5
+ Revision: 651416
+ rebuild (emptylog)

* Sat Oct 19 2013 umeabot <umeabot> 3.3.0-2.mga4
+ Revision: 535126
- Mageia 4 Mass Rebuild

* Wed Sep 18 2013 juergen_harms <juergen_harms> 3.3.0-1.mga4
+ Revision: 481173
- Upgrade to new upstream release
- Remove obsolete patches

* Sun Mar 24 2013 colin <colin> 3.2.1-11.mga3
+ Revision: 404859
- Add systemd requires and general post/pre fixes (mga#9302)

* Fri Jan 11 2013 umeabot <umeabot> 3.2.1-10.mga3
+ Revision: 346830
- Mass Rebuild - https://wiki.mageia.org/en/Feature:Mageia3MassRebuild

* Sun Nov 25 2012 colin <colin> 3.2.1-9.mga3
+ Revision: 321761
- Do not package tmpfiles conf in /etc
- Run systemd-tmpfiles --create on post install

* Sat Sep 08 2012 guillomovitch <guillomovitch> 3.2.1-8.mga3
+ Revision: 290478
- make webapp configuration file compatible with apache 2.4

  + juergen_harms <juergen_harms>
    - Add / correct variable definitions in config.pl (bugzilla 6530):
      SshPath, SmbClientPath, NmbLookupPath, TarClientPath, TopDir

* Thu Jun 07 2012 juergen_harms <juergen_harms> 3.2.1-6.mga3
+ Revision: 257000
- Add patches for CVE-2011-5081 and 4923

* Wed May 09 2012 pterjan <pterjan> 3.2.1-5.mga2
+ Revision: 234949
- Fix initscript's LSB header
- Fix License tag

* Sat Apr 28 2012 tmb <tmb> 3.2.1-4.mga2
+ Revision: 233603
- Require rpm-helper >= 0.24.8-1 for systemd support

* Fri Apr 27 2012 tmb <tmb> 3.2.1-3.mga2
+ Revision: 233503
- rebuild for versioned rpm-helper requires

* Sun Apr 22 2012 guillomovitch <guillomovitch> 3.2.1-2.mga2
+ Revision: 232584
- systemd support

* Sun Dec 04 2011 juergen_harms <juergen_harms> 3.2.1-1.3.mga2
+ Revision: 176052
- Restore userdel in postun (needed for build to succeed)
- Change ownership of backuppc.config to backupc:backuppc
- Remove %%_postun_userdel : the user "backuppc" must survive urpme backuppc
- Correct upstream perl syntax (patch2) to avoid throwing error messages
  at service start
- Add info to README.mga: user "backuppc" and backup-data

* Tue Nov 22 2011 juergen_harms <juergen_harms> 3.2.1-1.2.mga2
+ Revision: 170886
- Correct handling change of ownership (/etc/backuppc) in %%preun

* Tue Nov 22 2011 juergen_harms <juergen_harms> 3.2.1-1.1.mga2
+ Revision: 170847
- Tidy %%files section (avoid "listed twice" warnings for...BackupPC... files )
- Fix: "Edit Config" and "Edit Hosts" did not work from CGI interface:
  owner of /etc/backupc (and files) must be backuppc

* Fri Nov 18 2011 juergen_harms <juergen_harms> 3.2.1-1.mga2
+ Revision: 168885
- Import BackupPC-3.2.1 from upstream
- Drop xss.patch (it had fixed buzilla #2736 - upstream 3.2.1 contains that fix)
- Modify README.mdv: mdv -> mga; add recommendation on lighttpd server
  definition; improve wording.

* Wed Oct 26 2011 juergen_harms <juergen_harms> 3.2.0-4.2.mga2
+ Revision: 158224
- add backuppc-3.2.0-xss.patch to SOURCES
- rename xss.patch
- fix bugzilla #2736 (XSS problem : http://www.openwall.com/lists/oss-security/2011/0?\226?\128?\166)
- fix apache server definition (buzilla #600)
- correct cgi permissions (bugzilla #600)
- fix source URL

* Tue Sep 13 2011 boklm <boklm> 3.2.0-4.mga2
+ Revision: 143025
- fix lsb comment block

* Tue Apr 05 2011 ennael <ennael> 3.2.0-3.mga1
+ Revision: 80636
- clean spec file
- fix arch

* Sun Apr 03 2011 ennael <ennael> 3.2.0-2.mga1
+ Revision: 80229
- fix #600 (The http user-interface to backuppc does not work):
  use Debian wrapper

* Fri Mar 04 2011 ennael <ennael> 3.2.0-1.mga1
+ Revision: 64332
- clean spec file
- imported package backuppc