New percona monitor plugin package, new BackupPC packages

This commit is contained in:
2017-10-07 15:36:54 +02:00
parent decfd6f509
commit dbca6da7c2
4 changed files with 608 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
Name: BackupPC-XS
Version: 0.56
Release: 3%{?dist}
Summary: Implementation of various BackupPC functions in a perl-callable module
License: GPLv3+ and (GPL+ or Artistic) and zlib
URL: https://github.com/backuppc/backuppc-xs
Source0: https://github.com/backuppc/backuppc-xs/releases/download/%{version}/%{name}-%{version}.tar.gz
BuildRequires: gcc
BuildRequires: perl-interpreter perl-devel
BuildRequires: perl-generators
BuildRequires: perl(constant)
BuildRequires: perl(Exporter)
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(strict)
BuildRequires: perl(warnings)
BuildRequires: perl(XSLoader)
# Testing requirement
BuildRequires: perl(Test::More)
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Provides: bundled(zlib) = 1.2.3
%description
BackupPC::XS implements various BackupPC functions in a perl-callable
module. This module is required for BackupPC V4+.
%prep
%autosetup
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1
make
%install
make pure_install DESTDIR=%{buildroot}
%{_fixperms} %{buildroot}
%check
make test
%files
%doc Changes README
%{perl_vendorarch}/*
%exclude %dir %{perl_vendorarch}/auto/
%{_mandir}/man3/BackupPC::XS.3pm*
%changelog
* Sat Oct 7 2017 Daniel Steiner <daniel.steiner@greenmail.ch> - 4.1.3-2
- Iniital build.

339
fedora/SPECS/BackupPC.spec Normal file
View File

@@ -0,0 +1,339 @@
%global _hardened_build 1
%define backupdir /backup/%{name}
%define bpcuser backuppc
# tmpfiles.d & systemd support in all supported Fedora now, but not RHEL < 7
%if 0%{?fedora} || 0%{?rhel} >= 7
%global _with_tmpfilesd 1
%global _with_systemd 1
%endif
%global _updatedb_conf /etc/updatedb.conf
%global ver_major 4
%global ver_minor 1
%global ver_patch 3
%global ver_under %{ver_major}_%{ver_minor}_%{ver_patch}
Name: BackupPC
Version: %{ver_major}.%{ver_minor}.%{ver_patch}
Release: 1%{?dist}
Summary: High-performance backup system
License: GPLv2+
URL: http://backuppc.github.io/backuppc/index.html
Source0: https://github.com/backuppc/backuppc/releases/download/%{version}/%{name}-%{version}.tar.gz
Source1: BackupPC.htaccess
Source2: BackupPC.logrotate
Source3: README.setup
#A C wrapper to use since perl-suidperl is no longer provided
Source4: BackupPC_Admin.c
Source5: backuppc.service
Source6: BackupPC.tmpfiles
Source7: README.RHEL
Patch0: BackupPC-4.1.3-docfix.patch
BuildRequires: perl-generators
BuildRequires: perl(BackupPC::XS) >= 0.53
BuildRequires: perl(CGI)
BuildRequires: perl(Compress::Zlib)
BuildRequires: perl(Data::Dumper)
BuildRequires: perl(Digest::MD5)
BuildRequires: perl(Encode)
BuildRequires: perl(File::Listing)
BuildRequires: perl(Pod::Usage)
BuildRequires: perl(version)
%if 0%{?_with_systemd}
BuildRequires: systemd
%endif
BuildRequires: httpd-tools
# Unbundled libraries
Requires: perl(Net::FTP::AutoReconnect)
Requires: perl(Net::FTP::RetrHandle)
Requires: bzip2
Requires: httpd
Requires: iputils
Requires: openssh-clients
%if ! 0%{?el6}
Requires: par2cmdline
%endif
Requires: rrdtool
Requires: rsync-bpc >= 3.0.9.6
Requires: perl(Archive::Zip)
Requires: perl(BackupPC::XS) >= 0.53
Requires: perl(CGI)
Requires: perl(Compress::Zlib)
Requires: perl(Digest::MD5)
Requires: perl(Encode)
Requires: perl(File::Listing)
Requires: perl-Time-modules
Requires: perl(version)
Requires: perl(XML::RSS)
Requires: samba-client
Requires: %{_sbindir}/sendmail
Requires(pre): shadow-utils
%if 0%{?_with_systemd}
Requires(preun): systemd
Requires(post): systemd shadow-utils
Requires(postun): systemd
%else
Requires(preun): initscripts chkconfig
Requires(post): initscripts chkconfig shadow-utils
Requires(postun): initscripts
%endif
Requires: policycoreutils
BuildRequires: selinux-policy-devel checkpolicy
Provides: backuppc = %{version}
%description
BackupPC is a high-performance, enterprise-grade system for backing up Linux
and WinXX and Mac OS X PCs and laptops to a server's disk. BackupPC is highly
configurable and easy to install and maintain.
NOTE: Proper configuration is required after install, see README.setup for more
information.
%prep
%autosetup -p1
for f in ChangeLog; do
iconv -f ISO-8859-1 -t UTF-8 $f > $f.utf && mv $f.utf $f
done
cp %{SOURCE3} .
cp %{SOURCE7} .
cp %{SOURCE4} .
mkdir selinux
pushd selinux
cat >%{name}.te <<EOF
policy_module(%{name},0.0.5)
require {
type var_log_t;
type httpd_t;
class sock_file write;
type initrc_t;
class unix_stream_socket connectto;
type ssh_exec_t;
type ping_exec_t;
type sendmail_exec_t;
class file getattr;
type var_run_t;
class sock_file getattr;
type httpd_log_t;
class file open;
class dir read;
}
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 var_run_t:sock_file getattr;
allow httpd_t httpd_log_t:file open;
allow httpd_t httpd_log_t:dir read;
EOF
cat >%{name}.fc <<EOF
%{_sysconfdir}/%{name}(/.*)? gen_context(system_u:object_r:httpd_sys_script_rw_t,s0)
%{_sysconfdir}/%{name}/LOCK gen_context(system_u:object_r:httpd_lock_t,s0)
%{_localstatedir}/run/%{name}(/.*)? gen_context(system_u:object_r:var_run_t,s0)
%{_localstatedir}/log/%{name}(/.*)? gen_context(system_u:object_r:httpd_log_t,s0)
EOF
popd
# attempt to unbundle as much as possible
for m in Net/FTP; do
rm -rf lib/$m
sed -i "\@lib/$m@d" configure.pl
done
%build
# Build C wrapper
gcc -o BackupPC_Admin BackupPC_Admin.c %{optflags}
# SElinux
pushd selinux
make -f %{_datadir}/selinux/devel/Makefile
popd
%install
%{__perl} configure.pl \
--batch \
--backuppc-user=%{bpcuser} \
--dest-dir %{buildroot} \
--config-dir %{_sysconfdir}/%{name}/ \
--config-override CgiURL=\"http://localhost/%{name}\" \
--config-override ClientNameAlias=undef \
--config-override NmbLookupPath=\"%{_bindir}/nmblookup\" \
--config-override ParPath=\"%{_bindir}/par2\" \
--config-override PingPath=\"%{_bindir}/ping\" \
--config-override Ping6Path=\"%{_sbindir}/ping6\" \
--config-override RrdToolPath=\"%{_bindir}/rrdtool\" \
--config-override RsyncBackupPCPath=\"%{_bindir}/rsync_bpc\" \
--config-override RsyncClientPath=\"%{_bindir}/rsync\" \
--config-override SendmailPath=\"%{_sbindir}/sendmail\" \
--config-override SmbClientPath=\"%{_bindir}/smbclient\" \
--config-override SshPath=\"%{_bindir}/ssh\" \
--config-override TarClientPath=\"%{_bindir}/gtar\" \
--config-override XferMethod=\"rsync\" \
--cgi-dir %{_libexecdir}/%{name} \
--scgi-port -1 \
--data-dir %{backupdir} \
--hostname localhost \
--html-dir %{_datadir}/%{name}/html/ \
--html-dir-url /%{name}/images \
--install-dir %{_datadir}/%{name} \
--log-dir %{_localstatedir}/log/%{name} \
--no-set-perms \
--uid-ignore
# Make bin files executable
chmod +x %{buildroot}%{_datadir}/%{name}/bin/*
%if 0%{?_with_tmpfilesd}
mkdir -p %{buildroot}%{_tmpfilesdir}
install -p -m 0644 %{SOURCE6} %{buildroot}%{_tmpfilesdir}/%{name}.conf
%endif
mkdir -p %{buildroot}%{_localstatedir}/run/%{name}
%if 0%{?_with_systemd}
mkdir -p %{buildroot}%{_unitdir}
install -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}/
%else
mkdir -p %{buildroot}%{_initrddir}
install -p -m 0755 systemd/src/init.d/linux-%{bpcuser} %{buildroot}%{_initrddir}/%{bpcuser}
%endif
mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d/
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d/
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
mkdir -p %{buildroot}%{_sysconfdir}/%{name}/pc
install -p -m 0644 %{SOURCE1} \
%{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf
install -p -m 0644 %{SOURCE2} \
%{buildroot}%{_sysconfdir}/logrotate.d/%{name}
# perl-suidperl is no longer avaialable, we use a C wrapper
mkdir -p %{buildroot}%{_datadir}/%{name}/sbin
mv %{buildroot}%{_libexecdir}/%{name}/BackupPC_Admin \
%{buildroot}%{_datadir}/%{name}/sbin/BackupPC_Admin
install -pm 0755 BackupPC_Admin %{buildroot}%{_libexecdir}/%{name}/
# SElinux
mkdir -p %{buildroot}%{_datadir}/selinux/packages/%{name}
install -m 0644 selinux/%{name}.pp %{buildroot}%{_datadir}/selinux/packages/%{name}/%{name}.pp
# Create apache user auth file (backuppc/backuppc):
/usr/bin/htpasswd -b -c %{buildroot}%{_sysconfdir}/%{name}/apache.users %{bpcuser} %{bpcuser}
%pre
%{_sbindir}/useradd -d %{_localstatedir}/lib/%{name} -r -s /sbin/nologin %{bpcuser} 2> /dev/null || :
%preun
%if 0%{?_with_systemd}
%systemd_preun %{bpcuser}.service
%else
if [ $1 = 0 ]; then
# Package removal, not upgrade
service %{bpcuser} stop > /dev/null 2>&1 || :
chkconfig --del %{bpcuser} || :
fi
%endif
%post
(
# Install/update Selinux policy
semodule -i %{_datadir}/selinux/packages/%{name}/%{name}.pp
# files created by app
restorecon -R %{_sysconfdir}/%{name}
restorecon -R %{_localstatedir}/log/%{name}
) &>/dev/null
%if 0%{?_with_systemd}
%systemd_post %{bpcuser}.service
%else
if [ $1 -eq 1 ]; then
# initial installation
chkconfig --add %{bpcuser} || :
fi
%{_sbindir}/usermod -a -G %{bpcuser} apache || :
%endif
# add BackupPC backup directories to PRUNEPATHS in locate database
if [ -w %{_updatedb_conf} ]; then
grep ^PRUNEPATHS %{_updatedb_conf} | grep %{_localstatedir}/lib/%{name} > /dev/null
if [ $? -eq 1 ]; then
sed -i '\@PRUNEPATHS@s@"$@ '%{_localstatedir}/lib/%{name}'"@' %{_updatedb_conf}
fi
fi
:
%postun
# clear out any BackupPC configuration in apache
service httpd condrestart > /dev/null 2>&1 || :
if [ $1 -eq 0 ]; then
# uninstall
# Remove the SElinux policy.
semodule -r %{name} &> /dev/null || :
# remove BackupPC backup directories from PRUNEPATHS in locate database
if [ -w %{_updatedb_conf} ]; then
sed -i '\@PRUNEPATHS@s@[ ]*'%{_localstatedir}/lib/%{name}'@@' %{_updatedb_conf} || :
fi
fi
%systemd_postun_with_restart %{bpcuser}.service
%files
%doc README.md README.setup README.RHEL ChangeLog doc/*
%license LICENSE
%dir %attr(-,%{bpcuser},%{bpcuser}) %{_localstatedir}/log/%{name}
%dir %attr(-,%{bpcuser},%{bpcuser}) %{_sysconfdir}/%{name}/
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
%config(noreplace) %attr(0640,%{bpcuser},apache) %{_sysconfdir}/%{name}/config.pl
%config(noreplace) %attr(0640,%{bpcuser},apache) %{_sysconfdir}/%{name}/config.pl.sample
%config(noreplace) %attr(0640,%{bpcuser},apache) %{_sysconfdir}/%{name}/hosts.sample
%config(noreplace) %attr(0640,%{bpcuser},apache) %{_sysconfdir}/%{name}/hosts
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/%{name}/apache.users
%dir %attr(0750,%{bpcuser},apache) %{_sysconfdir}/%{name}/pc
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/sbin
%{_datadir}/%{name}/[^s]*
%attr(750,%{bpcuser},apache) %{_datadir}/%{name}/sbin/BackupPC_Admin
%if 0%{?_with_tmpfilesd}
%{_tmpfilesdir}/%{name}.conf
%endif
%dir %attr(0775,%{bpcuser},%{bpcuser}) %{_localstatedir}/run/%{name}
%if 0%{?_with_systemd}
%{_unitdir}/%{bpcuser}.service
%else
%attr(0755,root,root) %{_initrddir}/%{bpcuser}
%endif
%attr(4750,%{bpcuser},apache) %{_libexecdir}/%{name}/BackupPC_Admin
%attr(-,%{bpcuser},root) %{backupdir}/
%{_datadir}/selinux/packages/%{name}/%{name}.pp
%changelog
* Sat Oct 7 2017 Daniel Steiner <daniel.steiner@greenmail.ch> - 4.1.3-2
- Iniital build.

View File

@@ -0,0 +1,149 @@
Name: percona-monitoring-plugins
Summary: Percona Monitoring Plugins are high-quality components to add enterprise-class MySQL monitoring and graphing capabilities to your existing on-premise monitoring solutions.
Group: Applications/Databases
Version: 1.1.7
Release: 1%{?dist}
Distribution: %{distro_description}
License: GPL
Source: percona-monitoring-plugins-%{version}.tar.gz
Patch0: percona-cacti.patch
URL: http://www.percona.com/software/percona-monitoring-plugins
Packager: Percona MySQL Development Team <mysqldev@percona.com>
Vendor: Percona
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: PyYAML
%if 0%{?rhel} > 6
BuildRequires: perl-Digest-MD5
%else
BuildRequires: perl-MD5
%endif
%description
Summary: Percona Monitoring Plugins are high-quality components to add enterprise-class MySQL monitoring and graphing capabilities to your existing on-premise monitoring solutions.
##############################################################################
# Sub package definition
##############################################################################
%package -n percona-cacti-templates
Summary: Percona Monitoring Plugins for Cacti
Group: Applications/Databases
License: GPL
Requires: cacti >= 0.8.6
%description -n percona-cacti-templates
The Percona Monitoring Plugins are high-quality components to add enterprise-
grade MySQL monitoring and graphing capabilities to your existing in-house,
on-premises monitoring solutions. The components are designed to integrate
seamlessly with widely deployed solutions such as Nagios, Cacti and Zabbix,
and are delivered in the form of templates, plugins, and scripts.
%package -n percona-nagios-plugins
Summary: Percona Monitoring Plugins for Nagios
Group: Applications/Databases
License: GPL
%description -n percona-nagios-plugins
The Percona Monitoring Plugins are high-quality components to add enterprise-
grade MySQL monitoring and graphing capabilities to your existing in-house,
on-premises monitoring solutions. The components are designed to integrate
seamlessly with widely deployed solutions such as Nagios, Cacti and Zabbix,
and are delivered in the form of templates, plugins, and scripts.
%package -n percona-zabbix-templates
Summary: Percona Monitoring Plugins for Zabbix
Group: Applications/Databases
License: GPL
%description -n percona-zabbix-templates
The Percona Monitoring Plugins are high-quality components to add enterprise-
grade MySQL monitoring and graphing capabilities to your existing in-house,
on-premises monitoring solutions. The components are designed to integrate
seamlessly with widely deployed solutions such as Nagios, Cacti and Zabbix,
and are delivered in the form of templates, plugins, and scripts.
##############################################################################
%prep
%setup -q
%patch0
%build
./make.sh nodocs
%install
#========ZABBIX========
install -m 0755 -d $RPM_BUILD_ROOT/var/lib/zabbix/percona/scripts
install -m 0755 -d $RPM_BUILD_ROOT/var/lib/zabbix/percona/templates
install -m 0755 release/%{name}-%{version}/zabbix/scripts/* $RPM_BUILD_ROOT/var/lib/zabbix/percona/scripts
install -m 0644 release/%{name}-%{version}/zabbix/templates/* $RPM_BUILD_ROOT/var/lib/zabbix/percona/templates
#======================
#========NAGIOS========
install -m 0755 -d $RPM_BUILD_ROOT%{_libdir}/nagios/plugins
install -m 0755 release/%{name}-%{version}/nagios/bin/pmp-* $RPM_BUILD_ROOT%{_libdir}/nagios/plugins
#======================
#========CACTI=========
install -m 0755 -d $RPM_BUILD_ROOT/usr/share/cacti/resource/percona/bin
install -m 0755 -d $RPM_BUILD_ROOT/usr/share/cacti/resource/percona/definitions
install -m 0755 -d $RPM_BUILD_ROOT/usr/share/cacti/resource/percona/misc
install -m 0755 -d $RPM_BUILD_ROOT/usr/share/cacti/resource/percona/templates
install -m 0755 -d $RPM_BUILD_ROOT/usr/share/cacti/scripts
install -m 0755 release/%{name}-%{version}/cacti/bin/* $RPM_BUILD_ROOT/usr/share/cacti/resource/percona/bin
install -m 0644 release/%{name}-%{version}/cacti/definitions/* $RPM_BUILD_ROOT/usr/share/cacti/resource/percona/definitions
install -m 0644 release/%{name}-%{version}/cacti/misc/* $RPM_BUILD_ROOT/usr/share/cacti/resource/percona/misc
install -m 0644 release/%{name}-%{version}/cacti/templates/* $RPM_BUILD_ROOT/usr/share/cacti/resource/percona/templates
install -m 0644 release/%{name}-%{version}/cacti/scripts/*.php $RPM_BUILD_ROOT/usr/share/cacti/scripts
install -m 0755 release/%{name}-%{version}/cacti/scripts/*.py $RPM_BUILD_ROOT/usr/share/cacti/scripts
#======================
# exit 0 disables running helpers which generates *.pyc, *.pyo files.
exit 0
%clean
rm -rf $RPM_BUILD_ROOT
%post -n percona-zabbix-templates
echo
echo "Scripts are installed to /var/lib/zabbix/percona/scripts"
echo "Templates are installed to /var/lib/zabbix/percona/templates"
%files -n percona-zabbix-templates
%dir /var/lib/zabbix/percona
/var/lib/zabbix/percona/*
%post -n percona-nagios-plugins
echo
echo "Plugins are installed to %{_libdir}/nagios/plugins"
%files -n percona-nagios-plugins
%{_libdir}/nagios/plugins/*
%post -n percona-cacti-templates
echo
echo "Scripts are installed to /usr/share/cacti/scripts"
echo "Templates are installed to /usr/share/cacti/resource/percona"
%files -n percona-cacti-templates
%dir /usr/share/cacti/resource/percona
/usr/share/cacti/resource/percona/*
/usr/share/cacti/scripts/*
%changelog
* Thu Dec 1 2016 <evgeniy.patlan@percona.com> 1.1.7
- Initial Package

View File

@@ -0,0 +1,61 @@
%global ver_major 3
%global ver_minor 0
%global ver_patch 9
%global ver_tweak 6
%global ver_under %{ver_major}_%{ver_minor}_%{ver_patch}_%{ver_tweak}
Name: rsync-bpc
Version: 3.0.9.8
Release: 1%{?dist}
Summary: A customized version of rsync that is used as part of BackupPC
License: GPLv3+
URL: https://github.com/backuppc/rsync-bpc
Source0: https://github.com/backuppc/rsync-bpc/releases/download/%{version}/%{name}-%{version}.tar.gz
BuildRequires: autoconf
BuildRequires: gcc
BuildRequires: libacl-devel
BuildRequires: libattr-devel
BuildRequires: popt-devel
%description
Rsync-bpc is a customized version of rsync that is used as part of
BackupPC, an open source backup system.
The main change to rsync is adding a shim layer (in the subdirectory
backuppc, and in bpc_sysCalls.c) that emulates the system calls for
accessing the file system so that rsync can directly read/write files
in BackupPC's format.
Rsync-bpc is fully line-compatible with vanilla rsync, so it can talk
to rsync servers and clients.
Rsync-bpc serves no purpose outside of BackupPC.
%prep
%autosetup -n %{name}-%{version}
%build
%configure
%make_build
%install
%make_install
%files
%license COPYING
%doc NEWS README
%{_bindir}/rsync_bpc
%changelog
* Sat Oct 7 2017 Daniel Steiner <daniel.steiner@greenmail.ch> - 4.1.3-2
- Iniital build.