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.
92 lines
2.7 KiB
92 lines
2.7 KiB
%global _hardened_build 1 |
|
%define user listmonk |
|
%define group listmonk |
|
%define homedir /var/lib/listmonk/ |
|
%define logdir /var/log/listmonk/ |
|
|
|
Name : listmonk |
|
Version : 2.3.0 |
|
Release : 1%{dist} |
|
License : AGPLv3 |
|
Summary : High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. |
|
URL : https://listmonk.app |
|
Source0 : listmonk.service |
|
BuildRequires: golang |
|
BuildRequires: git |
|
|
|
|
|
%description |
|
listmonk is a standalone, self-hosted, newsletter and mailing list manager. |
|
It is fast, feature-rich, and packed into a single binary. |
|
It uses a PostgreSQL database as its data store. |
|
|
|
|
|
%prep |
|
%setup -T -q -c %{name}-%{version} |
|
export GOPATH=`pwd` |
|
mkdir -p go/src/github.com/knadh/ |
|
cd go/src/github.com/knadh/ |
|
git clone https://github.com/knadh/listmonk |
|
|
|
|
|
%build |
|
export GOPATH=`pwd` |
|
cd go/src/github.com/knadh/listmonk/ |
|
git checkout tags/v%{version} |
|
export SHORTCOMMIT=$(git rev-parse --short HEAD) |
|
export GO111MODULE=on |
|
export CGO_ENABLED=0 |
|
# frontend |
|
export VUE_APP_VERSION="v%{version}" |
|
pushd frontend |
|
yarnpkg install |
|
touch --no-create frontend/node_modules |
|
yarnpkg build |
|
popd |
|
# backend |
|
go build -v -trimpath -ldflags="-extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -X 'main.buildString="%{version}" - "${BUILDSTR}"' -X 'main.versionString="%{version}"' -X 'main.frontendDir=/usr/share/listmonk/theme/'" -o listmonk cmd/*.go |
|
|
|
|
|
%install |
|
install -p -D -m 0644 %{SOURCE0} %{buildroot}%{_unitdir}/%{name}.service |
|
mkdir -p %{buildroot}/%{homedir}/ |
|
install -p -D -m 0555 go/src/github.com/knadh/listmonk/listmonk %{buildroot}%{homedir}/listmonk |
|
install -p -D -m 0644 go/src/github.com/knadh/listmonk/config.toml.sample %{buildroot}%{homedir}/config.toml |
|
install -p -D -m 0644 go/src/github.com/knadh/listmonk/config.toml.sample %{buildroot}%{homedir}/config.toml.sample |
|
cp -r go/src/github.com/knadh/listmonk/*.sql %{buildroot}%{homedir}/ |
|
cp -r go/src/github.com/knadh/listmonk/static/ %{buildroot}%{homedir}/ |
|
mkdir -p %{buildroot}%{_datadir}/%{name}/ |
|
cp -r go/src/github.com/knadh/listmonk/frontend/dist/ %{buildroot}%{_datadir}/%{name}/theme/ |
|
cp -r go/src/github.com/knadh/listmonk/i18n/ %{buildroot}%{_datadir}/%{name}/ |
|
|
|
|
|
%pre |
|
getent group %{group} > /dev/null || groupadd -r %{group} |
|
getent passwd %{user} > /dev/null || useradd -r -d %{homedir} -g %{group} -s /bin/bash -c "%{name} user" %{user} |
|
exit 0 |
|
|
|
|
|
%post |
|
%systemd_post %{name}.service |
|
|
|
|
|
%preun |
|
%systemd_preun %{name}.service |
|
|
|
|
|
%postun |
|
%systemd_postun %{name}.service |
|
|
|
|
|
%files |
|
%config(noreplace) %{homedir}/config.toml |
|
%{homedir}/listmonk |
|
%{homedir}/*.sql |
|
%{homedir}/config.toml.sample |
|
%{homedir}/static/ |
|
%{_unitdir}/listmonk.service |
|
%{_datadir}/%{name}/theme/ |
|
%{_datadir}/%{name}/i18n/ |
|
|
|
|
|
%changelog
|
|
|