- Rx3 Profile:

- Add global & opt dir in global vars,
    - Add XDG_DATA_DIRS, HISTSIZE, HISTFILESIZE & _JAVA_OPTIONS variables,
- Base library:
    - Add DUMP flag to cmd_exec() & sh_exec(),
    - Add "-o errexit -o pipefail -o nounset -O extglob" for bash call in sh_exec(),
    - Prefix program name in cmd_exec() & sh_exec() verbose log,
- ISL:
    - Rename -d/--Dump option to -H/--html-dump,
    - Add RX3_LIB_DIR env variable support,
    - Fix variable quoting bug,
- URPMI-Setup:
    - Add Dump option by using the new DUMP flag,
    - Add RX3_LIB_DIR env variable support,
    - Fix a bug in media naming loop.
This commit is contained in:
2026-04-09 15:53:56 +02:00
parent f32b351a72
commit a5241043c0
6 changed files with 137 additions and 68 deletions

View File

@@ -1,3 +1,25 @@
------------------------------------------------------------------------------------------------------------------------------------
Rx3-Base V 1.1.1 - A. GIBERT - 2026/04/10
------------------------------------------------------------------------------------------------------------------------------------
- Rx3 Profile:
- Add global & opt dir in global vars,
- Add XDG_DATA_DIRS, HISTSIZE, HISTFILESIZE & _JAVA_OPTIONS variables,
- Base library:
- Add DUMP flag to cmd_exec() & sh_exec(),
- Add "-o errexit -o pipefail -o nounset -O extglob" for bash call in sh_exec(),
- Prefix program name in cmd_exec() & sh_exec() verbose log,
- ISL:
- Rename -d/--Dump option to -H/--html-dump,
- Add RX3_LIB_DIR env variable support,
- Fix variable quoting bug,
- URPMI-Setup:
- Add Dump option by using the new DUMP flag,
- Add RX3_LIB_DIR env variable support,
- Fix a bug in media naming loop.
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
Rx3-Base V 1.1.0 - A. GIBERT - 2026/04/09 Rx3-Base V 1.1.0 - A. GIBERT - 2026/04/09
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -25,7 +25,7 @@
%define name rx3-base %define name rx3-base
%define version 1.1.0 %define version 1.1.1
%define release %mkrel 1rx3 %define release %mkrel 1rx3
@@ -131,7 +131,10 @@ cp sbin/* %{buildroot}%{_sbindir}
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
%changelog %changelog
* Tue Apr 7 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.1.0-1rx3.mga9 * Fri Apr 10 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.1.1-1rx3.mga9
- Update to 1.1.1
* Thu Apr 9 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.1.0-1rx3.mga9
- Update to 1.1.0 - Update to 1.1.0
* Tue Mar 17 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.0.0-1rx3.mga9 * Tue Mar 17 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.0.0-1rx3.mga9

View File

@@ -27,9 +27,18 @@
# Global Variable # Global Variable
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
export PAGER=less export MANPATH=$MANPATH:/usr/local/share/man:/usr/global/share/man:/opt/share/man
export MANPAGER="less -isr" export CLASSPATH=$CLASSPATH:/usr/local/lib/java:/usr/global/lib/java:/usr/global/lib/java
export EDITOR=emacs export XDG_DATA_DIRS=$XDG_DATA_DIRS:/usr/share:/usr/local/share:/usr/global/share:/opt/share
export HISTSIZE=10000
export HISTFILESIZE=5000
export PAGER=less
export MANPAGER="less -isr"
export EDITOR=emacs
#export GIT_ASKPASS='/usr/bin/ksshaskpass'
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=gasp'
@@ -100,3 +109,4 @@ export -f file_enable
alias ll="ls -la" alias ll="ls -la"
alias em="emacs" alias em="emacs"
alias xw="startx"

View File

@@ -28,7 +28,8 @@
# Includes # Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/base.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/base.bash"
@@ -38,9 +39,9 @@
# Global Variables # Global Variables
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
declare -g VERSION="1.1.0" declare -g VERSION="1.1.1"
declare -g NAME="ISL" declare -g NAME="ISL"
declare -g HELP="usage: isl [-a | --add <URL>] | [-c | --cat [-r | --reverse]] | [-d | --dump [-i | --inline] [-r | --reverse]] | [-t | --top [-m | --image]] | [[-h | --help] | [-V | --version] [-T | --test] [-v | --verbose]" declare -g HELP="usage: isl [-a | --add <URL>] | [-c | --cat [-r | --reverse]] | [-H | --html_dump [-i | --inline] [-r | --reverse]] | [-t | --top [-m | --image]] | [[-h | --help] | [-V | --version] [-T | --test] [-v | --verbose]"
declare -g ISL_FILE="/etc/img_stack_log" declare -g ISL_FILE="/etc/img_stack_log"
declare -g EXIT_CODE=0 declare -g EXIT_CODE=0
@@ -60,7 +61,7 @@ declare -g URL=""
function isl_args_parse() function isl_args_parse()
{ {
tmp_args=$(getopt -o a:cdhtVimrTv --long add:,cat,dump,help,top,version,image,inline,reverse,test,verbose -- "$@") tmp_args=$(getopt -o a:chHtVimrTv --long add:,cat,help,html-dump,top,version,image,inline,reverse,test,verbose -- "$@")
if [ $? != 0 ] ; then echo_error "Terminating..."; exit 1 ; fi if [ $? != 0 ] ; then echo_error "Terminating..."; exit 1 ; fi
@@ -78,7 +79,7 @@ function isl_args_parse()
# Mode switches # Mode switches
-a|--add) MODE="ADD"; shift; URL="$1"; shift;; -a|--add) MODE="ADD"; shift; URL="$1"; shift;;
-c|--cat) MODE="CAT"; shift;; -c|--cat) MODE="CAT"; shift;;
-d|--dump) MODE="DUMP"; shift;; -H|--html-dump) MODE="HTML-DUMP"; shift;;
-h|--help) MODE="HELP"; shift;; -h|--help) MODE="HELP"; shift;;
-t|--top) MODE="TOP"; shift;; -t|--top) MODE="TOP"; shift;;
-V|--version) MODE="VERSION"; shift;; -V|--version) MODE="VERSION"; shift;;
@@ -101,17 +102,17 @@ function isl_args_parse()
else else
if [[ "${REVERSE}" == "TRUE" ]] if [[ "${REVERSE}" == "TRUE" ]]
then then
if [[ ( "${MODE}" != "CAT") && ( "${MODE}" != "DUMP") ]] if [[ ( "${MODE}" != "CAT") && ( "${MODE}" != "HTML-DUMP") ]]
then then
echo_error "Reverse option only valid in Cat or Dump mode!" echo_error "Reverse option only valid in Cat or HTML-Dump mode!"
MODE="HELP" MODE="HELP"
EXIT_CODE=1 EXIT_CODE=1
fi fi
fi fi
if [[ ( "${INLINE}" == "TRUE") && ( "${MODE}" != "DUMP") ]] if [[ ( "${INLINE}" == "TRUE") && ( "${MODE}" != "HTML-DUMP") ]]
then then
echo_error "Inline option only valid in Dump mode!" echo_error "Inline option only valid in HTML-Dump mode!"
MODE="HELP" MODE="HELP"
EXIT_CODE=1 EXIT_CODE=1
else else
@@ -163,12 +164,11 @@ isl_help_print()
isl_print() isl_print()
{ {
local inline="$1" local inline="$1"
shift
if [[ "${inline}" == "TRUE" ]] if [[ "${inline}" == "TRUE" ]]
then then
shift
str="%s"'\\n' str="%s"'\\n'
else else
str="%s"'\n' str="%s"'\n'
@@ -210,20 +210,20 @@ isl_add()
ts=$(date -u +"%Y/%m/%d %H:%M:%S") ts=$(date -u +"%Y/%m/%d %H:%M:%S")
if [[ ! -e ${ISL_FILE} ]] if [[ ! -e "${ISL_FILE}" ]]
then then
id=1 id=1
else else
id=$(( $(wc -l <${ISL_FILE}) + 1)) id=$(( $(wc -l <"${ISL_FILE}") + 1))
fi fi
str="${id} ${ts} ${reg} ${name} ${tag}" str="${id} ${ts} ${reg} ${name} ${tag}"
if [[ $id == "1" ]] if [[ $id == "1" ]]
then then
sh_exec 'echo "${str}" >${ISL_FILE}' sh_exec "echo \"${str}\" > \"${ISL_FILE}\""
else else
cmd_exec sed -i '1i\'"${str}" ${ISL_FILE} cmd_exec sed -i '1i\'"${str}" "${ISL_FILE}"
fi fi
} }
@@ -242,9 +242,9 @@ isl_cat()
if [[ "${reverse}" == "TRUE" ]] if [[ "${reverse}" == "TRUE" ]]
then then
cmd_exec tac ${ISL_FILE} cmd_exec tac "${ISL_FILE}"
else else
cmd_exec cat ${ISL_FILE} cmd_exec cat "${ISL_FILE}"
fi fi
} }
@@ -310,7 +310,7 @@ isl_top()
local line="" local line=""
line=$( head -1 ${ISL_FILE}) line=$( head -1 "${ISL_FILE}")
if [[ "$?" != "0" ]] if [[ "$?" != "0" ]]
then then
@@ -320,9 +320,9 @@ isl_top()
then then
set ${line} set ${line}
sh_exec 'echo "$5:$6"' sh_exec "echo \"$5:$6\""
else else
sh_exec 'echo "${line}"' sh_exec "echo \"${line}\""
fi fi
fi fi
} }
@@ -372,8 +372,8 @@ case "${MODE}" in
isl_cat "${REVERSE}" isl_cat "${REVERSE}"
;; ;;
"DUMP") "HTML-DUMP")
isl_dump "${REVERSE}" "${INLINE}" isl_html_dump "${REVERSE}" "${INLINE}"
;; ;;
"TOP") "TOP")

View File

@@ -28,7 +28,8 @@
# Includes # Includes
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/base.bash : "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/base.bash"
@@ -38,13 +39,11 @@
# Global Variables # Global Variables
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
declare -g VERSION="1.0.0" declare -g VERSION="1.0.1"
declare -g NAME="URPMI Setup" declare -g NAME="URPMI Setup"
declare -g HELP="usage: urpmi-setup [ [-d | --distrib <Distrib>] [-m | --mirror-mga <Mirror_List>] [-r | --mirror-rx3 <Mirror_List>] ] | [-h | --help] | [-V | --version] [-T | --test] [-u | --update] [-v | --verbose]" declare -g HELP="usage: urpmi-setup [ [-d | --distrib <Distrib>] [-m | --mirror-mga <Mirror_List>] [-r | --mirror-rx3 <Mirror_List>] ] | [-h | --help] | [-V | --version] [ [ -D | --dump] [-T | --test] ] [-u | --update] [-v | --verbose] ) ]"
declare -g DISTRIB_DEF="9" declare -g DISTRIB_DEF="9"
declare -g MIRRORLIST_MGA_DEF='http://mirror.xor.rx3/mageia/distrib/${DISTRIB}/x86_64 https://mirror.rx3.net/mageia/distrib/${DISTRIB}/x86_64 ftp://ftp.proxad.net/mirrors/mageia.org/distrib/${DISTRIB}/x86_64 http://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia/distrib/${DISTRIB}/x86_64'
declare -g MIRRORLIST_RX3_DEF='http://mirror.xor.rx3/rx3/distrib/${DISTRIB}/x86_64 https://mirror.rx3.net/rx3/distrib/${DISTRIB}/x86_64'
declare -g EXIT_CODE=0 declare -g EXIT_CODE=0
declare -g MODE="DEFAULT" declare -g MODE="DEFAULT"
@@ -57,14 +56,34 @@ declare -g UPDATE="FALSE"
#-----------------------------------------------------------------------------------------------------------------------------------
# MirrorList Init
#-----------------------------------------------------------------------------------------------------------------------------------
function us_mirrorlist_init()
{
if [[ "${MIRRORLIST_MGA}" == "" ]]
then
MIRRORLIST_MGA="http://mirror.xor.rx3/mageia/distrib/${DISTRIB}/x86_64 https://mirror.rx3.net/mageia/distrib/${DISTRIB}/x86_64 ftp://ftp.proxad.net/mirrors/mageia.org/distrib/${DISTRIB}/x86_64 http://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia/distrib/${DISTRIB}/x86_64"
fi
if [[ "${MIRRORLIST_RX3}" == "" ]]
then
MIRRORLIST_RX3="http://mirror.xor.rx3/rx3/distrib/${DISTRIB}/x86_64 https://mirror.rx3.net/rx3/distrib/${DISTRIB}/x86_64"
fi
}
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
# US Arg Parse # Arg Parse
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
function us_args_parse() function us_args_parse()
{ {
tmp_args=$(getopt -o d:hm:r:Tuv --long distrib:,help,mirror-mga:,mirror-rx3:,test,update,verbose -- "$@") tmp_args=$(getopt -o d:Dhm:r:Tuv --long distrib:,dump,help,mirror-mga:,mirror-rx3:,test,update,verbose -- "$@")
if [ $? != 0 ] ; then echo_error "Terminating..."; exit 1 ; fi if [ $? != 0 ] ; then echo_error "Terminating..."; exit 1 ; fi
@@ -84,6 +103,7 @@ function us_args_parse()
-V|--version) MODE="VERSION"; shift;; -V|--version) MODE="VERSION"; shift;;
# Global options # Global options
-D|--dump) DUMP="TRUE"; shift;;
-T|--test) DRY_RUN="TRUE"; shift;; -T|--test) DRY_RUN="TRUE"; shift;;
-u|--update) UPDATE="TRUE"; shift;; -u|--update) UPDATE="TRUE"; shift;;
-v|--verbose) VERBOSE="TRUE"; shift;; -v|--verbose) VERBOSE="TRUE"; shift;;
@@ -94,19 +114,19 @@ function us_args_parse()
esac esac
done done
if [[ ${DISTRIB} == "" ]] if [[ ( "${DUMP}" == "TRUE" ) && ( "${DRY_RUN}" == "TRUE" ) ]]
then then
DISTRIB=${DISTRIB_DEF} echo_error "Dump cannot be enabled with Test!"
fi
if [[ "${MIRRORLIST_MGA}" == "" ]] MODE="HELP";
then EXIT_CODE=1
eval MIRRORLIST_MGA=\"${MIRRORLIST_MGA_DEF}\" else
fi if [[ ${DISTRIB} == "" ]]
then
DISTRIB=${DISTRIB_DEF}
fi
if [[ "${MIRRORLIST_RX3}" == "" ]] us_mirrorlist_init
then
eval MIRRORLIST_RX3=\"${MIRRORLIST_RX3_DEF}\"
fi fi
} }
@@ -115,7 +135,7 @@ function us_args_parse()
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
# US Version Print # Version Print
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
us_version_print() us_version_print()
@@ -128,7 +148,7 @@ us_version_print()
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
# US Help Print # Help Print
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
us_help_print() us_help_print()
@@ -169,7 +189,7 @@ esac
echo_error "${NAME}: Mode: [${MODE}] Verbose: [${VERBOSE}] Dry_Run: [${DRY_RUN}] Distrib: [${DISTRIB}] MirrorList_MGA: [${MIRRORLIST_MGA}] MirrorList_RX3: [${MIRRORLIST_RX3}] Update: [${UPDATE}]" 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 cmd_exec urpmi.removemedia -a
cmd_exec rm -f /var/cache/urpmi/mirrors.cache cmd_exec rm -f /var/cache/urpmi/mirrors.cache
@@ -182,7 +202,7 @@ do
do do
for type in "Release" "Updates" for type in "Release" "Updates"
do do
cmd_exec urpmi.update --no-ignore "${media}" "${arch}${type}" cmd_exec urpmi.update --no-ignore "${media} ${arch}${type}"
done done
done done
done done

View File

@@ -22,11 +22,11 @@
# #
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
if [[ "${DEFAULT_BASH}" != "" ]] if [[ "${RX3_BASH_BASE}" != "" ]]
then then
return return
else else
declare -g DEFAULT_BASH=1 declare -g RX3_BASH_BASE=1
fi fi
@@ -46,11 +46,13 @@ shopt -s extglob
# Global Variable # Global Variable
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
declare -g VERSION=""
declare -g NAME="" declare -g NAME=""
declare -g VERSION=""
declare -g DUMP="FALSE"
declare -g DRY_RUN="FALSE"
declare -g HELP="" declare -g HELP=""
declare -g VERBOSE="FALSE" declare -g VERBOSE="FALSE"
declare -g DRY_RUN="FALSE"
declare -g LOG_FILE="" declare -g LOG_FILE=""
declare -g LOG_LOCK="" declare -g LOG_LOCK=""
@@ -164,14 +166,20 @@ cmd_exec()
local caller="${FUNCNAME[1]:-MAIN}" local caller="${FUNCNAME[1]:-MAIN}"
printf '[%s] ' "${caller}" >&2 printf '%s: [%s] ' "${NAME}" "${caller}" >&2
printf '%q ' "$@" >&2 printf '%q ' "$@" >&2
echo >&2 echo >&2
fi fi
if [[ "${DRY_RUN}" != "TRUE" ]] if [[ ${DUMP} == "TRUE" ]]
then then
"$@" printf '%q ' "$@"
echo
else
if [[ "${DRY_RUN}" != "TRUE" ]]
then
"$@"
fi
fi fi
} }
@@ -196,12 +204,18 @@ sh_exec()
local caller="${FUNCNAME[1]:-MAIN}" local caller="${FUNCNAME[1]:-MAIN}"
printf '[%s] bash -c %q\n' "${caller}" "$1" >&2 printf '%s: [%s] bash -c %q\n' "${NAME}" "${caller}" >&2
printf 'bash -c %q\n' "${NAME}" "${caller}" "$1" >&2
fi fi
if [[ "${DRY_RUN}" != "TRUE" ]] if [[ ${DUMP} == "TRUE" ]]
then then
bash -c -- "$1" bash printf 'bash -c %q\n' "${NAME}" "${caller}" "$1"
else
if [[ "${DRY_RUN}" != "TRUE" ]]
then
bash -o errexit -o pipefail -o nounset -O extglob -c -- "$1" bash
fi
fi fi
} }
@@ -331,7 +345,7 @@ file_lock()
if ! flock ${flag} -w 5 ${desc} if ! flock ${flag} -w 5 ${desc}
then then
err_echo "Failed to acquire [${mode}] lock on: [${file}]" echo_error "Failed to acquire [${mode}] lock on: [${file}]"
exit 1 exit 1
fi fi
} }