%global forgeurl https://github.com/cbeuw/Cloak %global version 2.10.0 %global commit d229d8b3dc0e026680c035d2b4a4d7af799557b3 %global date 20241004 %global debug_package %{nil} %global gomodulesmode GO111MODULE=on %forgemeta Name: cloak Version: %{forgeversion} Release: %{autorelease} Summary: Transport for traffic masquerading License: GPL-3.0-only URL: %{forgeurl} Source0: %{forgesource} Source1: %{name}@.service Source2: %{name}.howto BuildRequires: git-core BuildRequires: golang-bin BuildRequires: go-rpm-macros BuildRequires: systemd-rpm-macros %description Cloak provides a transport for traffic masquerading. This allows to circumvent censorship and data discrimination. %prep %forgesetup for CMD in client server do sed -e "s/CMD/${CMD}/g" %{SOURCE1} > %{name}-${CMD}@.service done %build export GOPROXY="https://proxy.golang.org,direct" export GOFLAGS="-trimpath" export GO_LDFLAGS="-s -w" for CMD in client server do %gobuild -o %{name}-${CMD} ./cmd/ck-${CMD} done %install for CMD in client server do install -p -d -m 700 %{buildroot}%{_sysconfdir}/%{name}/${CMD} install -p -D -m 644 -t %{buildroot}%{_unitdir} %{name}-${CMD}@.service install -p -D -m 755 -t %{buildroot}%{_bindir} %{name}-${CMD} install -p -D -m 644 -t %{buildroot}%{_pkgdocdir}/examples \ example_config/ck${CMD}.json done install -p -D -m 644 -t %{buildroot}%{_pkgdocdir} %{SOURCE2} README.md %post for UNIT in $(systemctl -P Id show %{name}@\*.service) do %systemd_post ${UNIT} done %preun for UNIT in $(systemctl -P Id show %{name}@\*.service) do %systemd_preun ${UNIT} done %postun for UNIT in $(systemctl -P Id show %{name}@\*.service) do %systemd_postun_with_restart ${UNIT} done %files %license LICENSE %doc %{_pkgdocdir} %{_sysconfdir}/* %{_unitdir}/* %{_bindir}/*