- 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

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