File croc.spec of Package croc

Name:           croc
Version:        10.3.0
Release:        1%{?dist}
Summary:        Easily and securely send things from one computer to another
License:        MIT
URL:            https://github.com/schollz/croc
Source0:        %{name}-%{version}.tar.xz
Source1:        vendor.tar.zst
BuildRequires:  golang-packaging
BuildRequires:  zstd

%description
croc is a tool that allows any two computers to simply and securely transfer files and folders. AFAIK, croc is the only CLI file-transfer tool that does all of the following:

   * Allows any two computers to transfer data (using a relay)
   * Provides end-to-end encryption (using PAKE)
   * Enables easy cross-platform transfers (Windows, Linux, Mac)
   * Allows multiple file transfers
   * Allows resuming transfers that are interrupted
   * No need for local server or port-forwarding
   * IPv6-first with IPv4 fallback
   * Can use a proxy, like Tor


%prep
%autosetup -p1 -a1

%build
go build -mod=vendor -buildmode=pie

%install
install -Dsm 755 %{name} %{buildroot}%{_bindir}/%{name}
install -Dm 644 %{name}.service %{buildroot}%{_unitdir}/%{name}.service


# The rest if from https://build.opensuse.org/package/show/network/croc

%check
# TestLocalIP and TestPublicIP require networking and will fail.
go test -skip "Test(Local|Public)IP" ./...

%pre
%service_add_pre %{name}.service

%post
%service_add_post %{name}.service

%preun
%service_del_preun %{name}.service

%postun
%service_del_postun %{name}.service

%files
%license LICENSE
%doc README.md
%{_bindir}/%{name}
%{_unitdir}/%{name}.service

%changelog

openSUSE Build Service is sponsored by