fix: update RPM spec using rpmbuild (#10979)
To test this PR > rpmbuild --undefine=_disable_source_fetch -ba minio.specmaster
parent
f139a19238
commit
350c5ff8f8
@ -1,83 +1,64 @@ |
|||||||
%define tag RELEASE.2017-04-25T01-27-49Z |
%define tag RELEASE.2020-11-25T22-36-25Z |
||||||
%define subver %(echo %{tag} | sed -e 's/[^0-9]//g') |
%define subver %(echo %{tag} | sed -e 's/[^0-9]//g') |
||||||
# git fetch https://github.com/minio/minio.git refs/tags/RELEASE.2017-02-16T01-47-30Z |
# git fetch https://github.com/minio/minio.git refs/tags/RELEASE.2020-11-25T22-36-25Z |
||||||
# git rev-list -n 1 FETCH_HEAD |
# git rev-list -n 1 FETCH_HEAD |
||||||
%define commitid 83abb310b4ce3a0dfc6d7faf78e33cb6f9132cfe |
%define commitid 91130e884b5df59d66a45a0aad4f48db88f5ca63 |
||||||
Summary: Cloud Storage Server. |
Summary: High Performance, Kubernetes Native Object Storage. |
||||||
Name: minio |
Name: minio |
||||||
Version: 0.0.%{subver} |
Version: 0.0.%{subver} |
||||||
Release: 1 |
Release: 1 |
||||||
Vendor: MinIO, Inc. |
Vendor: MinIO, Inc. |
||||||
License: Apache v2.0 |
License: Apache v2.0 |
||||||
Group: Applications/File |
Group: Applications/File |
||||||
Source0: https://github.com/minio/minio/archive/%{tag}.tar.gz |
Source0: https://dl.minio.io/server/minio/release/linux-amd64/archive/minio.%{tag} |
||||||
|
Source1: https://raw.githubusercontent.com/minio/minio-service/master/linux-systemd/distributed/minio.service |
||||||
URL: https://www.min.io/ |
URL: https://www.min.io/ |
||||||
BuildRequires: golang >= 1.7 |
Requires(pre): /usr/sbin/useradd, /usr/bin/getent |
||||||
|
Requires(postun): /usr/sbin/userdel |
||||||
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
||||||
|
|
||||||
## Disable debug packages. |
## Disable debug packages. |
||||||
%define debug_package %{nil} |
%define debug_package %{nil} |
||||||
|
|
||||||
## Go related tags. |
|
||||||
%define gobuild(o:) go build -ldflags "${LDFLAGS:-}" %{?**}; |
|
||||||
%define gopath %{_libdir}/golang |
|
||||||
%define import_path github.com/minio/minio |
|
||||||
|
|
||||||
%description |
%description |
||||||
MinIO is an object storage server released under Apache License v2.0. |
MinIO is a High Performance Object Storage released under Apache License v2.0. |
||||||
It is compatible with Amazon S3 cloud storage service. It is best |
It is API compatible with Amazon S3 cloud storage service. Use MinIO to build |
||||||
suited for storing unstructured data such as photos, videos, log |
high performance infrastructure for machine learning, analytics and application |
||||||
files, backups and container / VM images. Size of an object can |
data workloads. |
||||||
range from a few KBs to a maximum of 5TiB. |
|
||||||
|
|
||||||
%prep |
|
||||||
%setup -qc |
|
||||||
mv %{name}-*/* . |
|
||||||
|
|
||||||
install -d src/$(dirname %{import_path}) |
|
||||||
ln -s ../../.. src/%{import_path} |
|
||||||
|
|
||||||
%build |
|
||||||
export GOPATH=$(pwd) |
|
||||||
|
|
||||||
# setup flags like 'go run buildscripts/gen-ldflags.go' would do |
%pre |
||||||
tag=%{tag} |
/usr/bin/getent group minio-user || /usr/sbin/groupadd -r minio-user |
||||||
version=${tag#RELEASE.} |
/usr/bin/getent passwd minio-user || /usr/sbin/useradd -r -d /etc/minio -s /sbin/nologin minio-user |
||||||
commitid=%{commitid} |
|
||||||
scommitid=$(echo $commitid | cut -c1-12) |
|
||||||
prefix=%{import_path}/cmd |
|
||||||
|
|
||||||
LDFLAGS=" |
%install |
||||||
-X $prefix.Version=$version |
rm -rf $RPM_BUILD_ROOT |
||||||
-X $prefix.ReleaseTag=$tag |
install -d $RPM_BUILD_ROOT/etc/minio/certs |
||||||
-X $prefix.CommitID=$commitid |
install -d $RPM_BUILD_ROOT/etc/systemd/system |
||||||
-X $prefix.ShortCommitID=$scommitid |
install -d $RPM_BUILD_ROOT/etc/default |
||||||
" |
install -d $RPM_BUILD_ROOT/usr/local/bin |
||||||
|
|
||||||
%gobuild -o %{name} %{import_path} |
cat <<EOF >> $RPM_BUILD_ROOT/etc/default/minio |
||||||
|
# Remote volumes to be used for MinIO server. |
||||||
|
# Uncomment line before starting the server. |
||||||
|
# MINIO_VOLUMES=http://node{1...6}/export{1...32} |
||||||
|
|
||||||
# check that version set properly |
# Root credentials for the server. |
||||||
./%{name} version | tee v |
# Uncomment both lines before starting the server. |
||||||
|
# MINIO_ACCESS_KEY=Server-Access-Key |
||||||
|
# MINIO_SECRET_KEY=Server-Secret-Key |
||||||
|
|
||||||
#Version: 2016-09-11T17-42-18Z |
MINIO_OPTS="--certs-dir /etc/minio/certs" |
||||||
#Release-Tag: RELEASE.2016-09-11T17-42-18Z |
EOF |
||||||
#Commit-ID: 85e2d886bcb005d49f3876d6849a2b5a55e03cd3 |
|
||||||
v=$(awk '/Version:/{print $2}' v) |
|
||||||
test "$v" = $version |
|
||||||
v=$(awk '/Release-Tag:/{print $2}' v) |
|
||||||
test "$v" = $tag |
|
||||||
v=$(awk '/Commit-ID:/{print $2}' v) |
|
||||||
test "$v" = $commitid |
|
||||||
|
|
||||||
%install |
install %{_sourcedir}/minio.service $RPM_BUILD_ROOT/etc/systemd/system/minio.service |
||||||
rm -rf $RPM_BUILD_ROOT |
install -p %{_sourcedir}/%{name}.%{tag} $RPM_BUILD_ROOT/usr/local/bin/minio |
||||||
install -d $RPM_BUILD_ROOT%{_sbindir} |
|
||||||
install -p %{name} $RPM_BUILD_ROOT%{_sbindir} |
|
||||||
|
|
||||||
%clean |
%clean |
||||||
rm -rf $RPM_BUILD_ROOT |
rm -rf $RPM_BUILD_ROOT |
||||||
|
|
||||||
%files |
%files |
||||||
%defattr(644,root,root,755) |
%defattr(644,root,root,755) |
||||||
%doc README.md README_ZH.md |
%attr(644,root,root) /etc/default/minio |
||||||
%attr(755,root,root) %{_sbindir}/minio |
%attr(644,root,root) /etc/systemd/system/minio.service |
||||||
|
%attr(644,minio-user,minio-user) /etc/minio |
||||||
|
%attr(755,minio-user,minio-user) /usr/local/bin/minio |
||||||
|
Loading…
Reference in new issue