From a7e5a59670712d8a723ca79dc1841715ebef3791 Mon Sep 17 00:00:00 2001 From: nosqlbuilder_pel7x64builder0 Date: Thu, 24 Sep 2020 18:48:50 +0200 Subject: [PATCH] etcd package creation Signed-off-by: nosqlbuilder_pel7x64builder0 --- SPECS/etcd.spec | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 SPECS/etcd.spec diff --git a/SPECS/etcd.spec b/SPECS/etcd.spec new file mode 100644 index 0000000..d16a4ec --- /dev/null +++ b/SPECS/etcd.spec @@ -0,0 +1,69 @@ +Name: etcd +Version: 3.4.13 +%define gitversion ae9734e +Release: 1%{?dist} +Summary: Distributed reliable key-value store for the most critical data of a distributed system +License: ASL 2.0 +URL: https://github.com/etcd-io/etcd +Source0: https://github.com/etcd-io/etcd/archive/v%{version}.tar.gz +Source1: %{name}.service +Source2: %{name}.conf +%{?systemd_requires} +BuildRequires: systemd +Requires(pre): shadow-utils + + +%description +Distributed reliable key-value store for the most critical data of a distributed +system. + + +%prep +%setup -q -T -c %{name}-%{version} + + +%build +export GOPATH="`pwd`" +export CGO_ENABLED=0 +export GO111MODULE=on +#mkdir -p go/src/go.etcd.io/ +#cd go/src/go.etcd.io/ +mkdir -p go/src/github.com/ +cd go/src/github.com/ +git clone https://github.com/etcd-io/etcd +cd etcd +git checkout v%{version} +go mod vendor +go build -v -installsuffix cgo -ldflags "-extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -X go.etcd.io/etc/version.Version=%{version} -X go.etcd.io/etc/version.GitSHA=%{gitversion}" -o etcd +cd etcdctl +go build -v -installsuffix cgo -ldflags "-extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -X go.etcd.io/etc/version.Version=%{version} -X go.etcd.io/etc/version.GitSHA=%{gitversion}" -o etcdctl + + +%install +install -pDm755 go/src/github.com/etcd/etcd %{buildroot}%{_sbindir}/etcd +install -pDm755 go/src/github.com/etcd/etcdctl/etcdctl %{buildroot}%{_bindir}/etcdctl +install -pDm644 %{SOURCE1} %{buildroot}%{_unitdir}/etcd.service +install -pDm640 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}/etcd.conf +mkdir -p %{buildroot}%{_sharedstatedir}/%{name} + + +%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 +%{_sbindir}/etcd +%{_bindir}/etcdctl +%config(noreplace) %{_sysconfdir}/%{name} +%dir %attr(-,%{name},%{name}) %{_sharedstatedir}/%{name} +%{_unitdir}/%{name}.service + + +%changelog