Name: etcd Release: 1%{?dist} Summary: Distributed reliable key-value store for the most critical data of a distributed system %global etcd_repo https://github.com/etcd-io/etcd.git Version: 3.3.25 %global common_description %{expand: Distributed reliable key-value store for the most critical data of a distributed system.} %define debug_package %{nil} %define with_check 1 # Upstream license specification: Apache-2.0 License: ASL 2.0 URL: %{gourl} Source0: %{name}-%{version}.tar.gz Source1: %{name}.service Source2: %{name}.conf %{?systemd_requires} BuildRequires: systemd Requires(pre): shadow-utils BuildRequires: golang BuildRequires: git-core %description %{common_description} %prep rm -rf %{_builddir}/cache %setup -q -n etcd-%{version} -T -b 0 rm -f Documentation/README.md #git clone --single-branch --branch release-$(echo %version | rev | cut -d '.' -f 2- | rev) %etcd_repo (cd %{_builddir} ; mkdir -p src/github.com/coreos) (cd %{_builddir}/src/github.com/coreos && test -s %{name} || ln -s ../../../%{name}-%{version} %{name}) %build GOPATH=%{_builddir}/ GOCACHE=%{_builddir}/cache go build -o ./bin/etcd . GOPATH=%{_builddir}/ GOCACHE=%{_builddir}/cache go build -o ./bin/etcdctl ./etcdctl %install install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp ./bin/* %{buildroot}%{_bindir}/ install -Dpm 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service install -dm 0755 %{buildroot}%{_sysconfdir}/%{name} install -pm 644 -t %{buildroot}%{_sysconfdir}/%{name} %{SOURCE2} # # install manpages # install -d %{buildroot}%{_mandir}/man1 # install -pm 644 man/man1/* %{buildroot}%{_mandir}/man1 # And create /var/lib/etcd install -dm 0755 %{buildroot}%{_sharedstatedir}/%{name} %check %if %{with_check} GOPATH=%{_builddir}/ GOCACHE=%{_builddir}/cache PASSES="bom dep build" ./test %endif %pre getent group %{name} >/dev/null || groupadd -r %{name} getent passwd %{name} >/dev/null || useradd -r -g %{name} -d %{_sharedstatedir}/%{name} \ -s /sbin/nologin -c "etcd user" %{name} %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun %{name}.service %files %license LICENSE NOTICE %doc CODE_OF_CONDUCT.md CONTRIBUTING.md README.md ROADMAP.md %doc Documentation %{_bindir}/* %config(noreplace) %{_sysconfdir}/%{name} %dir %attr(-,%{name},%{name}) %{_sharedstatedir}/%{name} %{_unitdir}/%{name}.service