1 Star 0 Fork 1

冰淇淋/netcat

forked from src-oepkgs/netcat 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
netcat.spec 4.21 KB
一键复制 编辑 原始数据 按行查看 历史
root 提交于 2023-10-24 19:57 . modify
%global commit bc5a8259a456844c67e446bf6bd66575acc64837
%if 0%{?fedora} || 0%{?rhel} > 8
%global link_bin nc
%global link_man nc-man
%else
%global link_bin nmap
%global link_man ncman
%endif
Summary: OpenBSD netcat to read and write data across connections using TCP or UDP
Name: netcat
# Version from CVS revision of OpenBSD netcat.c
Version: 1.218
Release: 5%{?dist}
License: BSD
URL: https://man.openbsd.org/nc.1
Source0: https://raw.githubusercontent.com/openbsd/src/%{commit}/usr.bin/nc/netcat.c
Source1: https://raw.githubusercontent.com/openbsd/src/%{commit}/usr.bin/nc/nc.1
Source2: https://raw.githubusercontent.com/openbsd/src/%{commit}/usr.bin/nc/atomicio.c
Source3: https://raw.githubusercontent.com/openbsd/src/%{commit}/usr.bin/nc/atomicio.h
Source4: https://raw.githubusercontent.com/openbsd/src/%{commit}/usr.bin/nc/socks.c
Source5: https://raw.githubusercontent.com/openbsd/src/%{commit}/usr.bin/nc/Makefile
# Port peculiarities from OpenBSD to Linux
Patch0: https://salsa.debian.org/debian/netcat-openbsd/-/raw/9de0012ffa88e80abf582456eea1454f2ecb69f8/debian/patches/port-to-linux-with-libsd.patch
BuildRequires: make
BuildRequires: gcc
BuildRequires: libbsd-devel
BuildRequires: libretls-devel
Requires(post): %{_sbindir}/alternatives
Requires(preun): %{_sbindir}/alternatives
Obsoletes: nc < 1.109.20120711-2
Obsoletes: nc6 < 1.00-22
Provides: nc = %{version}-%{release}
Provides: nc6 = %{version}-%{release}
%description
The OpenBSD nc (or netcat) utility can be used for just about anything involving
TCP, UDP, or UNIX-domain sockets. It can open TCP connections, send UDP packets,
listen on arbitrary TCP and UDP ports, do port scanning, and deal with both IPv4
and IPv6. Unlike telnet(1), nc scripts nicely, and separates error messages onto
standard error instead of sending them to standard output, as telnet(1) might do
with some.
%prep
%setup -q -T -c
cp -pf %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} .
%patch0 -p1 -b .port-to-linux-with-libsd
sed -e '1i #define unveil(path, permissions) 0' \
-e '1i #define pledge(request, paths) 0' \
-i netcat.c
sed -e 's/^\(LIBS=.*\)/\1 -ltls/' -i Makefile
dnf config-manager --add-repo https://repo.oepkgs.net/openeuler/rpm/openEuler-20.03-LTS-SP1/compatible/c7/aarch64/
dnf clean all && dnf makecache
yum install -y libbsd-devel --nogpgcheck
yum install -y libretls-devel --nogpgcheck
%build
%make_build CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
%install
install -D -p -m 0755 nc $RPM_BUILD_ROOT%{_bindir}/%{name}
install -D -p -m 0644 nc.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1
touch $RPM_BUILD_ROOT%{_bindir}/nc
touch $RPM_BUILD_ROOT%{_mandir}/man1/nc.1.gz
%post
%{_sbindir}/alternatives --install %{_bindir}/nc %{link_bin} %{_bindir}/%{name} 10 \
--slave %{_mandir}/man1/nc.1.gz %{link_man} %{_mandir}/man1/%{name}.1.gz
%preun
if [ $1 -eq 0 ]; then
%{_sbindir}/alternatives --remove %{link_bin} %{_bindir}/%{name}
fi
%files
%ghost %{_bindir}/nc
%ghost %{_mandir}/man1/nc.1.gz
%{_bindir}/netcat
%{_mandir}/man1/netcat.1*
%changelog
* Sat May 14 2022 Robert Scheck <[email protected]> 1.218-5
- Rebuilt for libretls 3.5.2
* Sun Feb 27 2022 Robert Scheck <[email protected]> 1.218-4
- Rebuilt for libretls 3.5.0
* Thu Jan 20 2022 Fedora Release Engineering <[email protected]> - 1.218-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Sat Oct 16 2021 Robert Scheck <[email protected]> 1.218-2
- Rebuilt for libretls 3.4.1
* Mon Aug 30 2021 Robert Scheck <[email protected]> 1.218-1
- Upgrade to 1.218 (#1993735)
* Thu Jul 22 2021 Fedora Release Engineering <[email protected]> - 1.217-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Mar 17 2021 Robert Scheck <[email protected]> 1.217-3
- Changes to match the Fedora Packaging Guidelines (#1939769 #c1)
* Wed Mar 17 2021 Robert Scheck <[email protected]> 1.217-2
- Changes to match the Fedora Packaging Guidelines (#1939769)
* Sun Mar 07 2021 Robert Scheck <[email protected]> 1.217-1
- Upgrade to 1.217
- Initial spec file for Fedora and Red Hat Enterprise Linux
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/icace/netcat.git
[email protected]:icace/netcat.git
icace
netcat
netcat
master

搜索帮助