Name: centrifugo Version: 2.2.2 Release: 1%{?dist} Summary: Centrifugo is a real-time messaging server. License: MIT URL: https://github.com/centrifugal/centrifugo Group: Apps/sys BuildRequires: ca-certificates # we have incomplete git 2.14.1 in c7 repo, so we have to pin previous version here BuildRequires: git-core BuildRequires: golang BuildRequires: mr-rpm-macros BuildRequires: systemd-devel BuildRequires: systemd-units Source0: https://github.com/centrifugal/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz Source1: %{name}.config.json Source2: %{name}.service Source3: %{name}.logrotate Source4: %{name}.nofiles.conf Source5: %{name}.sysconfig BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot # go stuff %define debug_package %{nil} %define _enable_debug_packages 0 %define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v %{?debug:-x} %{?**}; %define import_path github.com/centrifugal/%{name} %description %{name} is a language-agnostic real-time messaging server. Language-agnostic means that it does not matter which programming language your application uses on frontend or backend sides – %{name} can work in conjunction with any. %prep %setup -qc %{__install} -d src/$(dirname %{import_path}) %{__mv} %{name}-%{version} src/%{import_path} cd src/%{import_path} %build export GOPATH=$(pwd) cd src/%{import_path} export PATH=$(pwd):$PATH go build %install %{__install} -Dpm 0755 src/%{import_path}/%{name} %{buildroot}%{_sbindir}/%{name} %{__install} -Dpm 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}/config.json %{__install} -Dpm 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service %{__install} -Dpm 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} %{__install} -Dpm 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/security/limits.d/%{name}.conf %{__install} -Dpm 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/sysconfig/%{name} %{__mkdir_p} %{buildroot}%{_sharedstatedir}/%{name} %{__mkdir_p} %{buildroot}%{_localstatedir}/log/%{name} %_fixperms %{buildroot}/* %pre getent passwd %{name} > /dev/null || \ useradd --system -U -M %{name} -s /bin/false -d %{_sharedstatedir}/%{name} %post echo "Executing systemd post-install tasks" %if 0%{?systemd_post:1} %systemd_post %{name}.service %else /bin/systemctl daemon-reload >/dev/null 2>&1 || : %endif %preun echo "Executing systemd pre-uninstall tasks" %if 0%{?systemd_preun:1} %systemd_preun %{name}.service %else if [ $1 -eq 0 ] ; then # Package removal, not upgrade /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || : /bin/systemctl stop %{name}.service > /dev/null 2>&1 || : fi %endif %files %defattr(-,root,root,-) %{_sbindir}/%{name} %config %{_sysconfdir}/%{name}/config.json %config %{_unitdir}/%{name}.service %config %{_sysconfdir}/logrotate.d/%{name} %config %{_sysconfdir}/security/limits.d/%{name}.conf %config %{_sysconfdir}/sysconfig/%{name} %dir %attr(0755, %{name}, %{name}) %{_localstatedir}/log/%{name} %doc src/github.com/centrifugal/centrifugo/README.md %doc src/github.com/centrifugal/centrifugo/CHANGELOG.md %doc src/github.com/centrifugal/centrifugo/LICENSE %changelog * Wed Jul 17 2019 Sergei Fedosov - Initial version