syncthing/syncthing.spec
2025-01-12 23:10:08 +00:00

100 lines
2 KiB
RPMSpec

%global debug_package %{nil}
%ifarch x86_64
%global altarch amd64
%endif
%ifarch %{ix86}
%global altarch 386
%endif
%ifarch %{arm}
%global altarch armv7
%endif
%define secscan 0
Name: syncthing
Version: 1.29.2
Release: 1
Summary: Syncthing
License: MIT
URL: http://syncthing.net/
Source0: https://github.com/syncthing/syncthing/archive/v%{version}/%{name}-%{version}.tar.gz
Source10: %{name}
Group: Networking/Other
BuildRequires: systemd
BuildRequires: procps
BuildRequires: go >= 1.10
BuildRequires: git-core
BuildRequires: pkgconfig(openssl3.3)
BuildRequires: upx
%if %{secscan}
BuildRequires: clamav
BuildRequires: trivy
%endif
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%description
Syncthing replaces Dropbox and BitTorrent Sync with something
open, trustworthy and decentralized. Your data is your data
alone and you deserve to choose where it is stored,
if it is shared with some third party and how it's
transmitted over the Internet.
Using syncthing, that control is returned to you.
%prep
%setup -q
%if %{secscan}
clamscan -ir .
trivy fs --scanners vuln --format cosign-vuln .
%endif
%build
export GOPROXY=https://proxy.golang.org/cached-only
go run build.go -version v%{version}
#./build.sh -version v%{version}
upx bin/%{name}
%install
rm -rf %{buildroot}
install -d %{buildroot}{%{_bindir},%{_unitdir},%{_sbindir},%{_mandir}/man1/%{name}}
install -pm 0755 bin/syncthing %{buildroot}%{_bindir}
# repair unit
sed -i '/MemoryDenyWriteExecute/d' etc/linux-systemd/system/%{name}@.service
install -pm 0644 etc/linux-systemd/system/%{name}@.service %{buildroot}%{_unitdir}
install -Dm0644 man/* %{buildroot}%{_mandir}/man1/%{name}
%post
%systemd_post %{name}@.service
%preun
%systemd_preun %{name}@.servie
%postun
%systemd_postun_with_restart %{name}@.service
%files
%doc LICENSE README.md
%{_bindir}/%{name}
%{_unitdir}/%{name}@.service
%{_mandir}/man1/%{name}
%check
export GOPROXY=https://proxy.golang.org/cached-only
#go test ./...
%if %{secscan}
clamscan -ir %{buildroot}
%endif
%changelog