File mariadb-release.spec of Package mariadb-release

%ifarch  %{ix86}
%global  Arch          x86
%else
%global  Arch          amd64
%endif

Name:    mariadb-release
Version: 1.0
Release: 1
Summary: The MariaDB server and related files Repository Configuration
Url:     https://mariadb.org/
Group:   System Environment/Base
License: GPLv2 with exceptions and LGPLv2 and BSD
Source1: mariadb.repo
Source2: RPM-GPG-KEY-MariaDB
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%description
The MariaDB server and related files Repository Configuration.

%prep
perl -pi -w -e 's|basearch|%{Arch}|g;' %{S:1}
%if 0%{?rhel_version} || 0%{?centos_version}
perl -pi -w -e 's|fedora|centos|g;' %{S:1}
%endif

%build
echo "Nothing to build"

%install
rm -rf $RPM_BUILD_ROOT

# Create dirs
install -d -m755 \
  $RPM_BUILD_ROOT%{_sysconfdir}/pki/rpm-gpg  \
  $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d

# GPG Key
cp -p %{S:2} $RPM_BUILD_ROOT%{_sysconfdir}/pki/rpm-gpg

# Yum .repo files
%{__install} -p -m644 %{S:1} \
    $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d


%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{_sysconfdir}/pki/rpm-gpg/*
%{_sysconfdir}/yum.repos.d/*

%changelog
* Sat May 07 2016 Muhammad Shaban <Mr.Muhammad@outlook.com> - 1.0-1
- Initial build 1