From e53a87d56a37735dbae47e4e04971c8030203073 Mon Sep 17 00:00:00 2001 From: "Arnaud G. GIBERT" Date: Sun, 3 May 2026 11:15:13 +0200 Subject: [PATCH] - Base library: Add optionnal "FORCE" flag to cmd_exec & sh_exec functions to overstep Test mode, - Split between rx3-base, rx3-base-config, rx3-base-libs and rx3-base-tools RPM packages. --- ReleaseNotes.txt | 4 +++- SPECS/rx3-base.spec | 58 +++++++++++++++++++++++++++++++++++++++------ lib/rx3/base.bash | 30 +++++++++++++++++++---- 3 files changed, 79 insertions(+), 13 deletions(-) diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index cb8535b..108f26a 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -1,7 +1,9 @@ ------------------------------------------------------------------------------------------------------------------------------------ -Rx3-Base V 1.1.2 - A. GIBERT - 2026/05/02 +Rx3-Base V 1.1.2 - A. GIBERT - 2026/05/03 ------------------------------------------------------------------------------------------------------------------------------------ +- Base library: Add optionnal "FORCE" flag to cmd_exec & sh_exec functions to overstep Test mode, +- Split between rx3-base, rx3-base-config, rx3-base-libs and rx3-base-tools RPM packages, - Move lib dir into top dir & remove usr, - Add www/cgi-bin dir, - Add urpmi-setup-dump.cgi and package it as example, diff --git a/SPECS/rx3-base.spec b/SPECS/rx3-base.spec index 6cbb778..39db86b 100644 --- a/SPECS/rx3-base.spec +++ b/SPECS/rx3-base.spec @@ -36,11 +36,12 @@ # Package #----------------------------------------------------------------------------------------------------------------------------------- -Summary: Rx3 Base Package Name: %{name} Version: %{version} Release: %{release} +Summary: Rx3 Base Meta Package + License: GPL 3.0 URL: https://git.rx3.org/gitea/rx3/%{name} Group: System @@ -51,6 +52,10 @@ Packager: Arnaud G. GIBERT BuildArch: noarch +Requires: %{name}-config +Requires: %{name}-libs +Requires: %{name}-tools + Source0: https://git.rx3.org/gitea/rx3/%{name}/archive/%{name}-%{version}.tar.gz @@ -59,7 +64,34 @@ Source0: https://git.rx3.org/gitea/rx3/%{name}/ar This is the base component of an Rx3 system: - Default config files, - Base bash libraries, - - Default tools. + - Base tools. + +This meta packe will install all the depencies. + + + +%package config +Summary: Rx3 Base Config + +%description config +This is a base component of an Rx3 system: Default config files. + + + +%package libs +Summary: Rx3 Base Libraires + +%description libs +This is a base component of an Rx3 system: Base bash libraries. + + + +%package tools +Summary: Rx3 Base Tools +Requires: %{name}-libs + +%description tools +This is a base component of an Rx3 system: Base tools. @@ -113,13 +145,24 @@ cp sbin/* %{buildroot}%{_sbindir} # Files #----------------------------------------------------------------------------------------------------------------------------------- -%files -%doc ReadMe.txt ReleaseNotes.txt ToDo.txt www/cgi-bin/urpmi-setup-dump.cgi +%files config +%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) %{_sysconfdir}/profile.d/* - %{_sysconfdir}/bash_completion.d/* + + +%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/* + +%files tools +%doc ReadMe.txt ReleaseNotes.txt ToDo.txt www/cgi-bin/urpmi-setup-dump.cgi +%license COPYING COPYING.LESSER GNU_GPL-3.0.txt GNU_LGPL-3.0.txt GNU_FDL-1.3.txt +%defattr(644,root,root) + %{_sysconfdir}/bash_completion.d/* %attr(0755,root,root) %{_sbindir}/* @@ -131,8 +174,9 @@ cp sbin/* %{buildroot}%{_sbindir} #----------------------------------------------------------------------------------------------------------------------------------- %changelog -* Sat May 2 2026 Arnaud G. GIBERT - 1.1.2-1rx3.mga9 -- Update to 1.1.2, +* Sun May 3 2026 Arnaud G. GIBERT - 1.1.2-1rx3.mga9 +- Update to 1.1.2 +- Split between rx3-base, rx3-base-config, rx3-base-libs and rx3-base-tools packages - Move lib source dir - Add cgi-bin example as doc diff --git a/lib/rx3/base.bash b/lib/rx3/base.bash index c627bc5..5ebda40 100644 --- a/lib/rx3/base.bash +++ b/lib/rx3/base.bash @@ -161,6 +161,16 @@ echo_error() cmd_exec() { + local force="FALSE" + + + if [[ "$1" == "FORCE" ]] + then + force="TRUE" + shift + fi + + if [[ "${VERBOSE}" == "TRUE" ]] then local caller="${FUNCNAME[1]:-MAIN}" @@ -171,12 +181,12 @@ cmd_exec() echo >&2 fi - if [[ ${DUMP} == "TRUE" ]] + if [[ ( "${force}" != "TRUE" ) && ( "${DUMP}" == "TRUE" ) ]] then printf '%q ' "$@" echo else - if [[ "${DRY_RUN}" != "TRUE" ]] + if [[ ( "${force}" == "TRUE" ) || ( "${DRY_RUN}" != "TRUE" ) ]] then "$@" fi @@ -193,9 +203,19 @@ cmd_exec() sh_exec() { + local force="FALSE" + + + if [[ "$1" == "FORCE" ]] + then + force="TRUE" + shift + fi + + if [[ "$#" -ne 1 ]] || [[ -z "$1" ]] then - echo_error "sh_exec expects exactly 1 non empty argument" + echo_error "sh_exec expects exactly 1 non empty argument after FORCE optional flag" return 1 fi @@ -208,11 +228,11 @@ sh_exec() printf 'bash -c %q\n' "${NAME}" "${caller}" "$1" >&2 fi - if [[ ${DUMP} == "TRUE" ]] + if [[ ( "${force}" != "TRUE" ) && ( "${DUMP}" == "TRUE" ) ]] then printf 'bash -c %q\n' "${NAME}" "${caller}" "$1" else - if [[ "${DRY_RUN}" != "TRUE" ]] + if [[ ( "${force}" == "TRUE" ) || ( "${DRY_RUN}" != "TRUE" ) ]] then bash -o errexit -o pipefail -o nounset -O extglob -c -- "$1" bash fi