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.

96 lines
2.9 KiB

%global _hardened_build 1
%define mattermost_user mattermost
%define mattermost_group mattermost
%define mattermost_home /var/lib/mattermost
%define mattermost_logdir /var/log/mattermost
#%define debug_package %{nil}
Name : mattermost
Version : 5.8.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
Requires : 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-server/
%build
export GOPATH=`pwd`
cd src/github.com/mattermost/mattermost-server/
git checkout tags/v%{version}
go get -d ./...
%ifarch ppc64 ppc64le
sed 's/amd64/%{_arch}/g' -i build/release.mk
%endif
make build-linux
%install
install -p -D -m 0644 bin/mattermost %{buildroot}%{_bindir}/mattermost
install -p -D -m 0644 bin/platform %{buildroot}%{_bindir}/mattermost-platform
install -p -D -m 0644 bin/interface_generator %{buildroot}%{_bindir}/mattermost-interface_generator
install -p -D -m 0644 %{SOURCE0} %{buildroot}%{_unitdir}/mattermost.service
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
cp -r src/github.com/mattermost/mattermost-server/config/* %{buildroot}%{_sysconfdir}/%{name}/
cp %{buildroot}%{_sysconfdir}/%{name}/default.json %{buildroot}%{_sysconfdir}/%{name}/config.json
mkdir -p %{buildroot}%{_datadir}/%{name}/
cp -r src/github.com/mattermost/mattermost-server/templates/ %{buildroot}%{_datadir}/%{name}/
cp -r src/github.com/mattermost/mattermost-server/fonts/ %{buildroot}%{_datadir}/%{name}/
cp -r src/github.com/mattermost/mattermost-server/i18n/ %{buildroot}%{_datadir}/%{name}/
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/mattermost
install -p -d -m 0700 %{buildroot}%{mattermost_home}
install -p -d -m 0700 %{buildroot}%{mattermost_logdir}
%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
%attr(775,%{mattermost_user},%{mattermost_group}) %{_sysconfdir}/%{name}/
%config(noreplace) %{_sysconfdir}/%{name}/config.json
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_bindir}/%{name}
%{_bindir}/%{name}-platform
%{_bindir}/%{name}-interface_generator
%{_datadir}/%{name}/templates/
%{_datadir}/%{name}/fonts/
%{_datadir}/%{name}/i18n/
%{_unitdir}/mattermost.service
%changelog