LinuxでもSpeedtestしたい(RPMパッケージが無い)

Red Hat

SPEC書いてビルドした。githubにRPMパッケージも置いておく。

自宅鯖で動けば良いやビルドなんで、SPECファイルの参考にはしないでください…。

%if (! 0%{?rhel}) || 0%{?rhel} > 6
%global with_python3 1
%endif

%global debug_package %{nil}

Name:           speedtest-cli
Version:        2.1.3
Release:        1%{?dist}
Summary:        Command line interface for testing internet bandwidth using speedtest.net

Group:          Application/System
License:        ASL 2.0
URL:            https://github.com/sivel/speedtest-cli
Source0:        https://github.com/sivel/speedtest-cli/archive/refs/tags/v%{version}.tar.gz
        
#BuildRequires: 
#Requires:      

%description
Command line interface for testing internet bandwidth using speedtest.net

%prep
%setup -q

%if 0%{?with_python3}
%{__sed} -i 's/env python/env python3/' ${RPM_BUILD_DIR}/speedtest-cli-%{version}/speedtest.py
%endif

%build
export PYTHONPATH="/usr/local/lib/python3.6/site-packages/:$PYTHONPATH"
pyinstaller --onefile ${RPM_BUILD_DIR}/speedtest-cli-%{version}/speedtest.py

%install
mkdir -p ${RPM_BUILD_ROOT}/%{_bindir}
install -m 755 ${RPM_BUILD_DIR}/speedtest-cli-%{version}/dist/speedtest ${RPM_BUILD_ROOT}/%{_bindir}
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man5/
install -p -m 644 speedtest-cli.1 ${RPM_BUILD_ROOT}%{_mandir}/man5/speedtest.5

%files
%{_bindir}/speedtest
%doc README.rst
%doc %{_mandir}/man5/*

%changelog
* Mon Nov 08 2021 Rio Fujita <rio@rio.st> - 2.1.3-1
- First build for RHEL8.4
タイトルとURLをコピーしました