You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.2 KiB

%global _hardened_build 1
%define mattermost_user mattermost
%define mattermost_group mattermost
%define mattermost_home /var/lib/mattermost-push-proxy/
%define debug_package %{nil}
Name : mattermost-push-proxy
Version : 5.9.0
Release : 1%{dist}
License : MIT
URL : https://mattermost.io
Summary : Open source Slack-alternative in Golang and React
Source0 : mattermost.service
Source1 : mattermost.logrotate
BuildRequires: golang
BuildRequires: git
%description
Mattermost is a flexible, open source messaging platform
that meets even the most demanding privacy and security standards.
%prep
%setup -T -q -c %{name}-%{version}
export GOPATH=`pwd`
mkdir -p src/github.com/mattermost/
cd src/github.com/mattermost/
git clone https://github.com/mattermost/mattermost-push-proxy/
%build
export GOPATH=`pwd`
export GO111MODULE=on
cd src/github.com/mattermost/mattermost-push-proxy/
git checkout tags/v%{version}
go mod init
go mod vendor
mkdir bin/
go build -o bin/ ./...
%install
mkdir -p %{buildroot}%{mattermost_home}/bin/
install -p -D -m 0555 src/github.com/mattermost/mattermost-push-proxy/bin/mattermost-push-proxy %{buildroot}%{mattermost_home}/bin/mattermost-push-proxy
mkdir -p %{buildroot}%{mattermost_home}/config/
cp -r src/github.com/mattermost/mattermost-push-proxy/config/* %{buildroot}%{mattermost_home}/config/
#install -p -D -m 0644 %{SOURCE0} %{buildroot}%{_unitdir}/mattermost.service
#install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/mattermost
%pre
getent group %{mattermost_group} > /dev/null || groupadd -r %{mattermost_group}
getent passwd %{mattermost_user} > /dev/null || \
useradd -r -d %{mattermost_home} -g %{mattermost_group} \
-s /bin/bash -c "Mattermost user" %{mattermost_user}
exit 0
%post
%systemd_post mattermost.service
%preun
%systemd_preun mattermost.service
%postun
%systemd_postun mattermost.service
%files
%defattr(-,%{mattermost_user},%{mattermost_group},-)
%attr(555,%{mattermost_user},%{mattermost_group}) %{mattermost_home}/bin/mattermost-push-proxy
#%config(noreplace) %{mattermost_home}/config/config.json
#%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
#%{mattermost_home}/config/
#%attr(644,root,root) %{_unitdir}/mattermost.service
%changelog