File mysql-tuning-scripts.spec of Package mysql-tuning-scripts
#
# spec file for package mysql-tuning-scripts
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# norootforbuild
Name: mysql-tuning-scripts
Summary: MySQL tuning scripts
Version: 2.5.2
Release: 1
License: GPL-2.0 and GPL-3.0+
Group: System/Monitoring
Url: http://github.com/rackerhacker/MySQLTuner-perl/
# http://github.com/rackerhacker/MySQLTuner-perl/
%define mysqltuner_version 2.5.2
Source1: MySQLTuner-perl-%{mysqltuner_version}.tar.bz2
# https://github.com/BMDan/tuning-primer.sh
Source2: tuning-primer.sh
%define tuning_primer_version 1.99
Source4: %name-README.SUSE
Requires: mysql-client
Requires: perl
Requires: perl(diagnostics)
Requires: perl(File::Spec)
Requires: perl(Getopt::Long)
Requires: perl(File::Basename)
Requires: perl(Cwd)
Requires: bash
Requires: bc
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-build
%description
This package contains scripts for tuning a MySQL database:
* tuning-primer.sh (Matthew Montgomery <mmontgomery@mysql.com>)
* mysqltuner.pl (Major Hayden - major@mhtx.net)
See /usr/share/doc/packages/%name for more information.
%prep
%setup -q -T -c %name -a1
#find . -type d -name .git -print0 | xargs -0 rm -rf
mv MySQLTuner-perl-%{mysqltuner_version}/* .
rm -rf MySQLTuner-perl-*
install -m755 %{SOURCE2} .
%build
#
%install
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_defaultdocdir}/%{name}
install -m755 tuning-primer.sh %{buildroot}/%{_bindir}/
if grep -q '/usr/bin/perl' mysqltuner.pl ; then
install -m755 mysqltuner.pl %{buildroot}/%{_bindir}/
else
echo '#!{_bindir}/perl -w' > %{buildroot}/%{_bindir}/mysqltuner.pl
cat mysqltuner.pl >> %{buildroot}/%{_bindir}/mysqltuner.pl
chmod 755 %{buildroot}/%{_bindir}/mysqltuner.pl
fi
# adjust tuning-primer.sh
%if 0%{?suse_version} >= 01330
sed -i "s|netstat|ss|g" %{buildroot}/%{_bindir}/tuning-primer.sh
%endif
sed -i "s|^socket=|socket='/run/mysql/mysql.sock'|g" %{buildroot}/%{_bindir}/tuning-primer.sh
# adjust mysqltuner.pl
sed -i "s|#!/usr/bin/env perl|#!%{_bindir}/perl|g" %{buildroot}/%{_bindir}/mysqltuner.pl
# documentation
for i in *.md ; do
install -m644 $i %{buildroot}/%{_defaultdocdir}/%{name}/mysqltuner-$i
done
for i in LICENSE vulnerabilities.csv basic_passwords.txt template_example.tpl ; do
install -m644 "$i" %{buildroot}/%{_defaultdocdir}/%{name}/mysqltuner-"$i"
done
install -m644 %{SOURCE4} %{buildroot}/%{_defaultdocdir}/%{name}/README.SUSE
%clean
rm -rf %buildroot
%files
%defattr(-, root, root)
%doc %{_defaultdocdir}/%{name}
%{_bindir}/*
%changelog