File croc.spec of Package croc

#
# spec file for package croc
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2021 Orville Q. Song <orville@anislet.dev>
# Copyright (c) 2024 Andreas Stieger <Andreas.Stieger@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           croc
Version:        10.1.1
Release:        0
Summary:        Easily and securely send things from one computer to another
License:        MIT
URL:            https://github.com/schollz/croc
Source0:        https://github.com/schollz/croc/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.xz
BuildRequires:  golang(API) >= 1.21
BuildRequires:  golang-packaging
%{go_nostrip}
%{go_provides}

%description
croc could easily and securely send things from one computer to another.

%prep
%autosetup -p1 -a1

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

%install
install -D -m 755 %{name} %{buildroot}%{_bindir}/%{name}
install -D -m 644 %{name}.service %{buildroot}%{_unitdir}/%{name}.service

%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