From 96e9b5524bba35408e9ee5c89460b3294f988e59 Mon Sep 17 00:00:00 2001 From: "Arnaud G. GIBERT" Date: Wed, 9 Sep 2026 20:24:54 +0200 Subject: [PATCH] - Base library: - Implement VSL (Version Stack Log), - ISL: - Add VSL support, - URPMI-Setup - Add VSL support. --- ReadMe.txt | 2 +- ReleaseNotes.txt | 13 +++ SPECS/rx3-base.spec | 5 +- lib/rx3/base.bash | 251 ++++++++++++++++++++++++++++++++++++++------ sbin/isl | 41 ++------ sbin/urpmi-setup | 13 ++- 6 files changed, 249 insertions(+), 76 deletions(-) diff --git a/ReadMe.txt b/ReadMe.txt index d55f0ed..9f8c439 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -1,4 +1,4 @@ -Welcome to Rx3 Base 1.1.x ! +Welcome to Rx3 Base 1.2.x ! diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 28ac154..953f58c 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -1,3 +1,16 @@ +------------------------------------------------------------------------------------------------------------------------------------ +Rx3-Base V 1.2.0 - A. GIBERT - 2026/09/11 +------------------------------------------------------------------------------------------------------------------------------------ + +- Base library: + - Implement VSL (Version Stack Log), +- ISL: + - Add VSL support, +- URPMI-Setup + - Add VSL support. + + + ------------------------------------------------------------------------------------------------------------------------------------ Rx3-Base V 1.1.3 - A. GIBERT - 2026/08/01 ------------------------------------------------------------------------------------------------------------------------------------ diff --git a/SPECS/rx3-base.spec b/SPECS/rx3-base.spec index c38684c..906531f 100644 --- a/SPECS/rx3-base.spec +++ b/SPECS/rx3-base.spec @@ -25,7 +25,7 @@ %define name rx3-base -%define version 1.1.3 +%define version 1.2.0 %define release %mkrel 1rx3 @@ -178,6 +178,9 @@ cp sbin/* %{buildroot}%{_sbindir} #----------------------------------------------------------------------------------------------------------------------------------- %changelog +* Fri Sep 11 2026 Arnaud G. GIBERT - 1.2.0-1rx3.mga9 +- Update to 1.2.0 + * Sat Aug 1 2026 Arnaud G. GIBERT - 1.1.3-1rx3.mga9 - Update to 1.1.3 diff --git a/lib/rx3/base.bash b/lib/rx3/base.bash index 5ebda40..38a8e31 100644 --- a/lib/rx3/base.bash +++ b/lib/rx3/base.bash @@ -46,45 +46,27 @@ shopt -s extglob # Global Variable #----------------------------------------------------------------------------------------------------------------------------------- -declare -g NAME="" -declare -g VERSION="" +declare -Ag LIB_VSL_TAB=() +declare -g LIB_VSL_ID_LIST="" +declare -g LIB_VSL_ID_NB=0 +declare -g LIB_VSL_NAME_LEN=0 +declare -g LIB_VSL_VERSION_LEN=0 -declare -g DUMP="FALSE" -declare -g DRY_RUN="FALSE" -declare -g HELP="" -declare -g VERBOSE="FALSE" +declare LIB_NAME="Base" +declare LIB_VERSION="1.2.0" -declare -g LOG_FILE="" -declare -g LOG_LOCK="" -declare -g LOG_ECHO="" -declare -g LOG_TRACE="DISABLED" +declare -g NAME="" +declare -g VERSION="" +declare -g DUMP="FALSE" +declare -g DRY_RUN="FALSE" +declare -g HELP="" +declare -g VERBOSE="FALSE" - - - -#----------------------------------------------------------------------------------------------------------------------------------- -# Version Print -#----------------------------------------------------------------------------------------------------------------------------------- - -version_print() -{ -# echo "${VERSION}" | sed -e 's/.*: //' -e 's/-/ /' -e 's/_/\./g' -e 's/\$$//' - echo "${NAME} V${VERSION}" -} - - - - - -#----------------------------------------------------------------------------------------------------------------------------------- -# Help Print -#----------------------------------------------------------------------------------------------------------------------------------- - -help_print() -{ - echo "${NAME} ${HELP}" -} +declare -g LOG_FILE="" +declare -g LOG_LOCK="" +declare -g LOG_ECHO="" +declare -g LOG_TRACE="DISABLED" @@ -243,6 +225,30 @@ sh_exec() +#----------------------------------------------------------------------------------------------------------------------------------- +# Print +#----------------------------------------------------------------------------------------------------------------------------------- + +print() +{ + local inline="${1}" + shift + + + if [[ "${inline}" == "TRUE" ]] + then + str="%s"'\\n' + else + str="%s"'\n' + fi + + cmd_exec printf "${str}" "$*" +} + + + + + #-------------------------------------------------------------------------------------------------------------------------- # Tab Assign #-------------------------------------------------------------------------------------------------------------------------- @@ -294,6 +300,171 @@ var_assign() +#-------------------------------------------------------------------------------------------------------------------------- +# VSL Add +#-------------------------------------------------------------------------------------------------------------------------- + +vsl_add() +{ + local name + local version + local file + + + if [[ "${BASH_SOURCE[1]}" == "$0" ]] + then + name="${NAME}" + version="${VERSION}" + file="${0}" + else + name="${LIB_NAME}" + version="${LIB_VERSION}" + file="${BASH_SOURCE[1]}" + fi + + var_assign LIB_VSL_ID_LIST "${LIB_VSL_ID_NB}" INC + + tab_assign LIB_VSL_TAB "${LIB_VSL_ID_NB},Name" "${name}" + tab_assign LIB_VSL_TAB "${LIB_VSL_ID_NB},Version" "${version}" + tab_assign LIB_VSL_TAB "${LIB_VSL_ID_NB},File" "${file}" + + if [[ "${#name}" -gt "${LIB_VSL_NAME_LEN}" ]] + then + LIB_VSL_NAME_LEN="${#name}" + fi + + if [[ "${#version}" -gt "${LIB_VSL_VERSION_LEN}" ]] + then + LIB_VSL_VERSION_LEN="${#version}" + fi + + LIB_VSL_ID_NB=$(( ${LIB_VSL_ID_NB} + 1)) +} + + + + + +#----------------------------------------------------------------------------------------------------------------------------------- +# VSL HTML Dump +#----------------------------------------------------------------------------------------------------------------------------------- + +vsl_html_dump() +{ + local reverse="$1" + local inline="$2" + + local i=1 + local j=1 + local vsl_id + local vsl_id_list + local name + local version + local file + + + if [[ "${reverse}" == "TRUE" ]] + then + vsl_id_list="$( echo "${LIB_VSL_ID_LIST}" | tr ' ' '\n' | tac)" + else + vsl_id_list="$( echo "${LIB_VSL_ID_LIST}" | tr ' ' '\n')" + fi + + for vsl_id in ${vsl_id_list} + do + name=${LIB_VSL_TAB["${vsl_id},Name"]} + version=${LIB_VSL_TAB["${vsl_id},Version"]} + file=${LIB_VSL_TAB["${vsl_id},File"]} + + if [[ $(( $i % 2)) -eq 0 ]] + then + print "${inline}" ' ' + else + print "${inline}" " " + fi + + print "${inline}" " ${i}${name}${version}" + + if [[ "${VERBOSE}" == "TRUE" ]] + then + print "${inline}" "${file}" + fi + + print "${inline}" " " + i=$(( $i + 1)) + done +} + + + + + +#----------------------------------------------------------------------------------------------------------------------------------- +# Version Print +#----------------------------------------------------------------------------------------------------------------------------------- + +version_print() +{ + local full="${1-TRUE}" + + local name_len + local version_len + local vsl_id_list + local vsl_id + local name + local version + local file + + + if [[ "${full}" == "TRUE" ]] + then + vsl_id_list="$( echo "${LIB_VSL_ID_LIST}" | tr ' ' '\n' | tac)" + name_len="${LIB_VSL_NAME_LEN}" + version_len="${LIB_VSL_VERSION_LEN}" + else + vsl_id_list="$(( ${LIB_VSL_ID_NB} - 1))" + name_len="${#LIB_VSL_TAB["${vsl_id_list},Name"]}" + version_len="${#LIB_VSL_TAB["${vsl_id_list},Version"]}" + fi + + name_len=$(( ${name_len} + 1 )) + version_len=$(( ${version_len} + 1 )) + + for vsl_id in ${vsl_id_list} + do + name=${LIB_VSL_TAB["${vsl_id},Name"]} + version=${LIB_VSL_TAB["${vsl_id},Version"]} + file=${LIB_VSL_TAB["${vsl_id},File"]} + + str="$(printf "%s%*sV %s" "${name}" "$((${name_len} - ${#name}))" " " "${version}")" + + if [[ "${VERBOSE}" == "TRUE" ]] + then + str+="$(printf "%*s%s" "$((${version_len} - ${#version}))" " " "${file}")" + fi + + echo "${str}" + done +} + + + + + +#----------------------------------------------------------------------------------------------------------------------------------- +# Help Print +#----------------------------------------------------------------------------------------------------------------------------------- + +help_print() +{ + version_print + echo "${NAME} ${HELP}" +} + + + + + #-------------------------------------------------------------------------------------------------------------------------- # File Dir Init #-------------------------------------------------------------------------------------------------------------------------- @@ -510,3 +681,13 @@ log_error() { log_print "${LOG_FILE}" "${LOG_LOCK}" "${LOG_ECHO}" "ERR" "$@" } + + + + + +#-------------------------------------------------------------------------------------------------------------------------- +# Main +#-------------------------------------------------------------------------------------------------------------------------- + +vsl_add diff --git a/sbin/isl b/sbin/isl index e60a714..638f39e 100755 --- a/sbin/isl +++ b/sbin/isl @@ -39,7 +39,7 @@ # Global Variables #----------------------------------------------------------------------------------------------------------------------------------- -declare -g VERSION="1.1.1" +declare -g VERSION="1.2.0" declare -g NAME="ISL" declare -g HELP="usage: isl [-a | --add ] | [-c | --cat [-r | --reverse]] | [-H | --html_dump [-i | --inline] [-r | --reverse]] | [-t | --top [-m | --image]] | [[-h | --help] | [-V | --version] [-T | --test] [-v | --verbose]" @@ -90,7 +90,7 @@ function isl_args_parse() # --) shift; break;; - *) echo_error "args_parse internal error [$1] !"; exit 1;; + *) echo_error "args_parse internal error [$1] !"; exit 1;; esac done @@ -149,7 +149,6 @@ isl_version_print() isl_help_print() { - version_print help_print } @@ -157,30 +156,6 @@ isl_help_print() -#----------------------------------------------------------------------------------------------------------------------------------- -# ISL Print -#----------------------------------------------------------------------------------------------------------------------------------- - -isl_print() -{ - local inline="$1" - shift - - - if [[ "${inline}" == "TRUE" ]] - then - str="%s"'\\n' - else - str="%s"'\n' - fi - - cmd_exec printf "${str}" "$*" -} - - - - - #----------------------------------------------------------------------------------------------------------------------------------- # ISL Add #----------------------------------------------------------------------------------------------------------------------------------- @@ -273,9 +248,9 @@ isl_html_dump() if [[ $(( $i % 2)) -eq 0 ]] then - isl_print "${inline}" ' ' + print "${inline}" ' ' else - isl_print "${inline}" " " + print "${inline}" " " fi j=1 @@ -283,15 +258,15 @@ isl_html_dump() do if [[ "$j" == "1" ]] then - isl_print "${inline}" " ${!j}" + print "${inline}" " ${!j}" else - isl_print "${inline}" " ${!j}" + print "${inline}" " ${!j}" fi j=$(( $j + 1)) done - isl_print "${inline}" " " + print "${inline}" " " i=$(( $i + 1)) done } @@ -335,6 +310,8 @@ isl_top() # Main #----------------------------------------------------------------------------------------------------------------------------------- +vsl_add + orig_args=("$@") isl_args_parse "$@" diff --git a/sbin/urpmi-setup b/sbin/urpmi-setup index f56f987..b8e6046 100755 --- a/sbin/urpmi-setup +++ b/sbin/urpmi-setup @@ -39,8 +39,8 @@ # Global Variables #----------------------------------------------------------------------------------------------------------------------------------- -declare -g VERSION="1.0.2" -declare -g NAME="URPMI Setup" +declare -g VERSION="1.2.0" +declare -g NAME="URPMI-Setup" declare -g HELP="usage: urpmi-setup [ [-d | --distrib ] [-m | --mirror-mga ] [-r | --mirror-rx3 ] ] | [-h | --help] | [-V | --version] [ [ -D | --dump] | [-T | --test] ] [-u | --update] [-v | --verbose] ) ]" declare -g DISTRIB_DEF="9" @@ -110,7 +110,7 @@ function us_args_parse() # --) shift; break;; - *) echo_error "args_parse internal error [$1] !"; exit 1;; + *) echo_error "args_parse internal error [$1] !"; exit 1;; esac done @@ -153,7 +153,6 @@ us_version_print() us_help_print() { - version_print help_print } @@ -165,13 +164,14 @@ us_help_print() # Main #----------------------------------------------------------------------------------------------------------------------------------- +vsl_add + orig_args=("$@") us_args_parse "$@" -case "${MODE}" in - +case "${MODE}" in "EXIT") exit ${EXIT_CODE} ;; @@ -188,7 +188,6 @@ case "${MODE}" in esac - echo_error "${NAME}: Mode: [${MODE}] Verbose: [${VERBOSE}] Dump: [${DUMP}] Dry_Run: [${DRY_RUN}] Distrib: [${DISTRIB}] MirrorList_MGA: [${MIRRORLIST_MGA}] MirrorList_RX3: [${MIRRORLIST_RX3}] Update: [${UPDATE}]" cmd_exec urpmi.removemedia -a