- 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:
    - 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 1fd7c1730e
6 changed files with 126 additions and 57 deletions

View File

@@ -22,11 +22,11 @@
#
#-----------------------------------------------------------------------------------------------------------------------------------
if [[ "${DEFAULT_BASH}" != "" ]]
if [[ "${RX3_BASH_BASE}" != "" ]]
then
return
else
declare -g DEFAULT_BASH=1
declare -g RX3_BASH_BASE=1
fi
@@ -46,11 +46,13 @@ shopt -s extglob
# Global Variable
#-----------------------------------------------------------------------------------------------------------------------------------
declare -g VERSION=""
declare -g NAME=""
declare -g VERSION=""
declare -g DUMP="FALSE"
declare -g DRY_RUN="FALSE"
declare -g HELP=""
declare -g VERBOSE="FALSE"
declare -g DRY_RUN="FALSE"
declare -g LOG_FILE=""
declare -g LOG_LOCK=""
@@ -162,16 +164,22 @@ cmd_exec()
if [[ "${VERBOSE}" == "TRUE" ]]
then
local caller="${FUNCNAME[1]:-MAIN}"
printf '[%s] ' "${caller}" >&2
printf '%q ' "$@" >&2
echo >&2
fi
if [[ "${DRY_RUN}" != "TRUE" ]]
then
"$@"
printf '%s: [%s] ' "${NAME}" "${caller}" >&2
printf '%q ' "$@" >&2
echo >&2
fi
if [[ ${DUMP} == "TRUE" ]]
then
printf '%q ' "$@"
echo
else
if [[ "${DRY_RUN}" != "TRUE" ]]
then
"$@"
fi
fi
}
@@ -194,14 +202,20 @@ sh_exec()
if [[ "${VERBOSE}" == "TRUE" ]]
then
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
if [[ "${DRY_RUN}" != "TRUE" ]]
if [[ ${DUMP} == "TRUE" ]]
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
}
@@ -331,7 +345,7 @@ file_lock()
if ! flock ${flag} -w 5 ${desc}
then
err_echo "Failed to acquire [${mode}] lock on: [${file}]"
echo_error "Failed to acquire [${mode}] lock on: [${file}]"
exit 1
fi
}