#-----------------------------------------------------------------------------------------------------------------------------------
#
# Network Tools
#
# Copyright (C) 2025-2026 Arnaud G. GIBERT
# mailto:arnaud@rx3.net
#
# This is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; If not, see
# .
#
#-----------------------------------------------------------------------------------------------------------------------------------
%define name network_tools
%define version 1.2.0
%define release %mkrel 1rx3
%global debug_package %{nil}
%global _webdir %{_localstatedir}/www
%global _webcgi %{_webdir}/cgi-bin
%global _webhtml %{_webdir}/html
Name: %{name}
Version: %{version}
Release: %{release}
Summary: Rx3 Network Tools
License: GPL
URL: https://git.rx3.org/gitea/rx3/%{name}
Source0: https://git.rx3.org/gitea/rx3/%{name}/archive/%{name}-%{version}.tar.gz
Distribution: Rx3 Free Software
Vendor: Rx3
Packager: Arnaud G. GIBERT
BuildArch: noarch
Requires: %{name}-libs
%description
These tools aims to manage network operation on Rx3 systems. This include:
- Boot time network setup,
- Comand line management tools,
- Web interface tools.
The following topics are tageted:
- Virtual network interface,
- VPN,
- Proxy,
- Port forwarding,
- Dynamic DNS.
This release support IPTables and OpenVPN.
%package libs
Summary: Rx3 Network Tools Libraries
Requires: rx3-base
Requires: bind-utils
%description libs
These tools aims to manage network operation on Rx3 systems.
This is the bash libraires.
#-----------------------------------------------------------------------------------------------------------------------------------
# Prep
#-----------------------------------------------------------------------------------------------------------------------------------
%prep
%setup -q -n %{name}
#-----------------------------------------------------------------------------------------------------------------------------------
# Build
#-----------------------------------------------------------------------------------------------------------------------------------
%build
#-----------------------------------------------------------------------------------------------------------------------------------
# Install
#-----------------------------------------------------------------------------------------------------------------------------------
%install
# Config
%{__mkdir_p} %{buildroot}%{_sysconfdir}/sysconfig
cp etc/sysconfig/* %{buildroot}%{_sysconfdir}/sysconfig
# SystemD
%{__mkdir_p} %{buildroot}%{_unitdir}
cp etc/systemd/system/* %{buildroot}%{_unitdir}
# Bash completion
%{__mkdir_p} %{buildroot}%{_sysconfdir}/bash_completion.d
cp etc/bash_completion.d/* %{buildroot}%{_sysconfdir}/bash_completion.d
# Lib
%{__mkdir_p} %{buildroot}%{_prefix}/lib/rx3
cp lib/rx3/*.bash %{buildroot}%{_prefix}/lib/rx3
# Bin
%{__mkdir_p} %{buildroot}%{_sbindir}
cp sbin/* %{buildroot}%{_sbindir}
# WWW
%{__mkdir_p} %{buildroot}%{_webcgi}
cp www/cgi-bin/*.cgi %{buildroot}%{_webcgi}
#-----------------------------------------------------------------------------------------------------------------------------------
# Check
#-----------------------------------------------------------------------------------------------------------------------------------
%check
#-----------------------------------------------------------------------------------------------------------------------------------
# Post
#-----------------------------------------------------------------------------------------------------------------------------------
%post
%_post_service rx3-network
%_post_service rx3-vpn
#-----------------------------------------------------------------------------------------------------------------------------------
# Preun
#-----------------------------------------------------------------------------------------------------------------------------------
%preun
%_preun_service rx3-vpn
%_preun_service rx3-network
#-----------------------------------------------------------------------------------------------------------------------------------
# Files
#-----------------------------------------------------------------------------------------------------------------------------------
%files
%doc ReadMe.txt ReleaseNotes.txt ToDo.txt
%license COPYING COPYING.LESSER GNU_GPL-3.0.txt GNU_LGPL-3.0.txt GNU_FDL-1.3.txt
%config(noreplace) %{_sysconfdir}/sysconfig/*
%defattr(644,root,root)
%{_sysconfdir}/bash_completion.d/*
%{_unitdir}/*.service
%defattr(0755,root,root)
%{_sbindir}/*
%{_webcgi}/*.cgi
%files libs
%doc ReadMe.txt ReleaseNotes.txt ToDo.txt
%license COPYING COPYING.LESSER GNU_GPL-3.0.txt GNU_LGPL-3.0.txt GNU_FDL-1.3.txt
%defattr(644,root,root)
%{_prefix}/lib/rx3/*
#-----------------------------------------------------------------------------------------------------------------------------------
# ChangeLog
#-----------------------------------------------------------------------------------------------------------------------------------
%changelog
* Tue Apr 21 2026 Arnaud G. GIBERT - 1.2.0-1rx3.mga9
- Create initial SPEC file for 1.2.0 on Mageia 9