diff --git a/mtr-0.92.tar.gz b/mtr-0.92.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..ae9b5d40bd1ae647e124490f44448559d5bea273 Binary files /dev/null and b/mtr-0.92.tar.gz differ diff --git a/mtr-gtk-pkexec-wrapper.sh b/mtr-gtk-pkexec-wrapper.sh new file mode 100644 index 0000000000000000000000000000000000000000..c61ee7721ee078a74d113c007970f81c0c952df3 --- /dev/null +++ b/mtr-gtk-pkexec-wrapper.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +error_message="You are trying to run mtr-gtk in a Wayland session, however mtr-gtk requires root privileges and such graphical applications are not allowed to run on Wayland by default.\n\nSee https://gitee.com/openeuler/community/issues \#wayland-root-apps for more details and possible workarounds.\n" + +if [ "$XDG_SESSION_TYPE" = wayland ]; then + zenity --error --title "mtr-gtk on Wayland" --text "$error_message" --width=600 2>/dev/null || printf "$error_message" >&2 + exit 1 +fi + +/usr/bin/pkexec /usr/bin/xmtr.bin diff --git a/mtr.spec b/mtr.spec new file mode 100644 index 0000000000000000000000000000000000000000..f0bbe3960a8e0dca9c414f2095d49d70b3248205 --- /dev/null +++ b/mtr.spec @@ -0,0 +1,93 @@ +%global _hardened_build 1 + +Name: mtr +Version: 0.92 +Release: 7 +Epoch: 2 +Summary: Ping and Traceroute Network Diagnostic Tool +License: GPLv2 and BSD +URL: https://www.bitwizard.nl/mtr/ +Source0: https://github.com/traviscross/mtr/archive/v%{version}/%{name}-%{version}.tar.gz +Source1: net-x%{name}.desktop +Source2: mtr-gtk-pkexec-wrapper.sh +Source3: org.fedoraproject.mtr.policy + +BuildRequires: git autoconf automake libtool ncurses-devel gtk2-devel desktop-file-utils + +Provides: %{name}-gtk = %{epoch}:%{version}-%{release} +Obsoletes: %{name}-gtk < %{epoch}:%{version}-%{release} + +%description +It is a network diagnostic tool,it has the "ping" and "traceroute" features. +It prints information about the route and packets that sent from the host to +the specified destination system.This tool can also print the response times +and percentage for all network hops between the systems. + +%package_help + +%prep +%autosetup -n %{name}-%{version} + +%build +export CFLAGS="%{optflags} -fPIE" +export LDFLAGS="-z now -pie" + +echo "%{version}" > .tarball-version + +./bootstrap.sh +%configure --with-gtk +%make_build && mv -f mtr xmtr.bin && make distclean +%configure --without-gtk +%make_build + +%install +install -D -p -m 0755 mtr %{buildroot}%{_sbindir}/mtr +install -D -p -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/xmtr +install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_datadir}/polkit-1/actions/org.fedoraproject.mtr.policy +install -D -p -m 0755 xmtr.bin %{buildroot}%{_bindir}/xmtr.bin +install -D -p -m 0644 img/mtr_icon.xpm %{buildroot}%{_datadir}/pixmaps/mtr_icon.xpm + +%make_install +desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1} + +%check +make test + +%files +%license COPYING BSDCOPYING +%doc AUTHORS FORMATS +%caps(cap_net_raw=pe) +%{_bindir}/xmtr* +%{_sbindir}/%{name} +%{_sbindir}/%{name}-packet +%{_datadir}/pixmaps/mtr_icon.xpm +%{_datadir}/applications/net-x%{name}.desktop +%{_datadir}/bash-completion/completions/%{name} +%{_datadir}/polkit-1/actions/org.fedoraproject.mtr.policy + +%files help +%defattr(-,root,root) +%doc NEWS README SECURITY TODO +%{_mandir}/man8/* + +%changelog +* Sat Dec 28 2019 openEuler Buildteam - 2:0.92-7 +- Type:bugfix +- Id:NA +- SUG:NA +- DESC:modify the spec + +* Thu Nov 7 2019 openEuler Buildteam - 2:0.92-6 +- Type:enhancement +- Id:NA +- SUG:NA +- DESC:modify the spec1 + +* Sat Oct 26 2019 openEuler Buildteam - 2:0.92-5 +- Type:enhancement +- Id:NA +- SUG:NA +- DESC:modify the license + +* Mon Oct 14 2019 openEuler Buildteam - 2:0.92-4 +- Package init diff --git a/net-xmtr.desktop b/net-xmtr.desktop new file mode 100644 index 0000000000000000000000000000000000000000..a5570fab1c8cd13b801723c3d97b9b6baa9beb60 --- /dev/null +++ b/net-xmtr.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Traceroute +Type=Application +Comment=Traces packets between two network hosts +Exec=xmtr +Terminal=false +Icon=mtr_icon.xpm +Encoding=UTF-8 +X-Desktop-File-Install-Version=0.2 +Categories=System;Application; diff --git a/org.fedoraproject.mtr.policy b/org.fedoraproject.mtr.policy new file mode 100644 index 0000000000000000000000000000000000000000..f9e68b4c1cc2185afc3d9cce534de70c7ff3a32b --- /dev/null +++ b/org.fedoraproject.mtr.policy @@ -0,0 +1,17 @@ + + + + + Run mtr + Authentication is required to run traceroute + + no + no + auth_admin_keep + + /usr/bin/xmtr.bin + true + +