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.

53 lines
1.9 KiB

%define mattermost_user mattermost
%define mattermost_group mattermost
%define mattermost_home /var/lib/mattermost
%define debug_package %{nil}
Name: mattermost-plugin-welcomebot
Version: 1.2.0
Release: 1%{?dist}
URL: https://github.com/mattermost/mattermost-plugin-welcomebot/
Summary: Plugin for Mattermost as a Welcome Bot
License: Apache
BuildRequires: golang
Requires: mattermost
%description
%prep
%setup -q -T -c %{name}-%{version}
export GOPATH=`pwd`
go get -u -v github.com/golang/dep/cmd/dep
mkdir -p src/github.com/mattermost/
cd src/github.com/mattermost/
git clone https://github.com/mattermost/mattermost-plugin-welcomebot
%build
export GOPATH=`pwd`
export PATH="bin:"$PATH
export GO111MODULE=on
cd src/github.com/mattermost/mattermost-plugin-welcomebot
go mod download
go build -ldflags '-extldflags -s -w -buildid %{version}' -o plugin.exe ./server
%install
mkdir -p %{buildroot}%{mattermost_home}/plugins/com.mattermost.welcomebot/server/dist/
cp -rv src/github.com/mattermost/mattermost-plugin-welcomebot/plugin.json %{buildroot}%{mattermost_home}/plugins/com.mattermost.welcomebot/
sed 's/"executables": {/"executables": { "server\/dist\/plugin.exe"/' -i %{buildroot}%{mattermost_home}/plugins/com.mattermost.welcomebot/plugin.json
sed '/"darwin-amd64"/d' -i %{buildroot}%{mattermost_home}/plugins/com.mattermost.welcomebot/plugin.json
sed '/"linux-amd64"/d' -i %{buildroot}%{mattermost_home}/plugins/com.mattermost.welcomebot/plugin.json
sed '/"windows-amd64"/d' -i %{buildroot}%{mattermost_home}/plugins/com.mattermost.welcomebot/plugin.json
cp -rv src/github.com/mattermost/mattermost-plugin-welcomebot/plugin.exe %{buildroot}%{mattermost_home}/plugins/com.mattermost.welcomebot/server/dist/
%files
%{mattermost_home}/plugins/com.mattermost.welcomebot/plugin.json
%{mattermost_home}/plugins/com.mattermost.welcomebot/server/dist/plugin.exe
%changelog