!1 modify the spec

Merge pull request !1 from openeuler-net/init
This commit is contained in:
openeuler-ci-bot 2019-12-29 16:52:56 +08:00 committed by Gitee
commit b2648a714e
5 changed files with 130 additions and 0 deletions

BIN
mtr-0.92.tar.gz Normal file

Binary file not shown.

10
mtr-gtk-pkexec-wrapper.sh Normal file
View File

@ -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

93
mtr.spec Normal file
View File

@ -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 <buildteam@openeuler.org> - 2:0.92-7
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:modify the spec
* Thu Nov 7 2019 openEuler Buildteam <buildteam@openeuler.org> - 2:0.92-6
- Type:enhancement
- Id:NA
- SUG:NA
- DESC:modify the spec1
* Sat Oct 26 2019 openEuler Buildteam <buildteam@openeuler.org> - 2:0.92-5
- Type:enhancement
- Id:NA
- SUG:NA
- DESC:modify the license
* Mon Oct 14 2019 openEuler Buildteam <buildteam@openeuler.org> - 2:0.92-4
- Package init

10
net-xmtr.desktop Normal file
View File

@ -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;

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<action id="org.fedoraproject.mtr.pkexec.run">
<description>Run mtr</description>
<message>Authentication is required to run traceroute</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/xmtr.bin</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>