Author SHA1 Message Date
AlkorZ3 895a46e903 - URPMI-Setup:
- Now install Rx3 CA certificate.
2026-10-30 13:55:27 +01:00
AlkorZ3 e9e5697d39 - Fix version_print call in help_print. 2026-09-13 12:06:44 +02:00
AlkorZ3 96e9b5524b - Base library:
- Implement VSL (Version Stack Log),
- ISL:
    - Add VSL support,
- URPMI-Setup
    - Add VSL support.
2026-09-11 20:20:16 +02:00
AlkorZ3 d1f671c128 - Rx3 Profile:
- Add PATH management.
2026-08-01 18:12:18 +02:00
AlkorZ3 e53a87d56a - 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.
2026-05-03 11:27:24 +02:00
AlkorZ3 98b85c14b4 - Move lib dir into top dir & remove usr,
- Add www/cgi-bin dir,
- Add urpmi-setup-dump.cgi and package it as example,
- URPMI-Setup:
    - Fix usage message.
2026-05-02 18:28:41 +02:00
AlkorZ3 f0ea953c63 - Fix Complete ReleaseNotes file. 2026-04-19 12:10:14 +02:00
AlkorZ3 d38a486b6e - Mouve lib & sbin out of usr,
- Remove usr dir,
- Add urpmi-setup-dump.cgi.
2026-04-16 19:10:39 +02:00
AlkorZ3 64dd7a911e - Move sbin dir into usr,
- Fix usage message in urpmi-setup.
2026-04-16 14:16:22 +02:00
AlkorZ3 a5241043c0 - 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.
2026-04-10 17:40:14 +02:00
8 changed files with 581 additions and 151 deletions

No files matched your search

+4 -4
View File
@@ -1,11 +1,11 @@
Welcome to Rx3 Base 1.1.x !
Welcome to Rx3 Base 1.2.x !
This is the base component of an Rx3 system:
- Default config files,
- Base bash libraries,
- Default tools.
- Default config file (rx3.sh),
- Base bash library,
- Default tools (isl & urpmi-setup).
+67
View File
@@ -1,3 +1,70 @@
------------------------------------------------------------------------------------------------------------------------------------
Rx3-Base V 1.2.1 - A. GIBERT - 2026/10/30
------------------------------------------------------------------------------------------------------------------------------------
- URPMI-Setup:
- Now install Rx3 CA certificate.
------------------------------------------------------------------------------------------------------------------------------------
Rx3-Base V 1.2.0 - A. GIBERT - 2026/09/13
------------------------------------------------------------------------------------------------------------------------------------
- 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
------------------------------------------------------------------------------------------------------------------------------------
- Rx3 Profile:
- Add PATH management.
------------------------------------------------------------------------------------------------------------------------------------
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,
- URPMI-Setup:
- Fix usage message.
------------------------------------------------------------------------------------------------------------------------------------
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
------------------------------------------------------------------------------------------------------------------------------------
+72 -7
View File
@@ -25,7 +25,7 @@
%define name rx3-base
%define version 1.1.0
%define version 1.2.1
%define release %mkrel 1rx3
@@ -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 <arnaud@rx3.net>
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.
@@ -99,7 +131,7 @@ cp etc/bash_completion.d/* %{buildroot}%{_sysconfdir}/bash_completi
# Libs
%{__mkdir_p} %{buildroot}%{_prefix}/lib/rx3
cp usr/lib/rx3/*.bash %{buildroot}%{_prefix}/lib/rx3
cp lib/rx3/*.bash %{buildroot}%{_prefix}/lib/rx3
# Bin
%{__mkdir_p} %{buildroot}%{_sbindir}
@@ -113,13 +145,28 @@ cp sbin/* %{buildroot}%{_sbindir}
# Files
#-----------------------------------------------------------------------------------------------------------------------------------
%files
%files
%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,7 +178,25 @@ cp sbin/* %{buildroot}%{_sbindir}
#-----------------------------------------------------------------------------------------------------------------------------------
%changelog
* Tue Apr 7 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.1.0-1rx3.mga9
* Fri Oct 30 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.2.1-1rx3.mga9
- Update to 1.2.1
* Sun Sep 13 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.2.0-1rx3.mga9
- Update to 1.2.0
* Sat Aug 1 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.1.3-1rx3.mga9
- Update to 1.1.3
* Sun May 3 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 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
* 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
* Tue Mar 17 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.0.0-1rx3.mga9
+24 -3
View File
@@ -27,9 +27,29 @@
# Global Variable
#-----------------------------------------------------------------------------------------------------------------------------------
export PAGER=less
export MANPAGER="less -isr"
export EDITOR=emacs
for prefix in "/opt/" "/usr/" "/" "/usr/global/" "/usr/local/"
do
for suffix in bin sbin
do
dir=${prefix}${suffix}
PATH="${dir}:$(echo $PATH | sed -e "s%^${dir}:%%" -e "s%:${dir}:%:%" -e "s%:${dir}$%%")"
done
done
export PATH
export MANPATH=$MANPATH:/usr/local/share/man:/usr/global/share/man:/opt/share/man
export CLASSPATH=$CLASSPATH:/usr/local/lib/java:/usr/global/lib/java:/usr/global/lib/java
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 +120,4 @@ export -f file_enable
alias ll="ls -la"
alias em="emacs"
alias xw="startx"
+273 -58
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,43 +46,27 @@ shopt -s extglob
# Global Variable
#-----------------------------------------------------------------------------------------------------------------------------------
declare -g VERSION=""
declare -g NAME=""
declare -g HELP=""
declare -g VERBOSE="FALSE"
declare -g DRY_RUN="FALSE"
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 LOG_FILE=""
declare -g LOG_LOCK=""
declare -g LOG_ECHO=""
declare -g LOG_TRACE="DISABLED"
declare LIB_NAME="Base"
declare LIB_VERSION="1.2.0"
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"
@@ -123,8 +107,8 @@ str_escape()
echo_line()
{
local string="$1"
local count="$2"
local string="${1}"
local count="${2:-""}"
echo -en "\e[2K\r"
@@ -159,19 +143,35 @@ echo_error()
cmd_exec()
{
local force="FALSE"
if [[ "$1" == "FORCE" ]]
then
force="TRUE"
shift
fi
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 [[ ( "${force}" != "TRUE" ) && ( "${DUMP}" == "TRUE" ) ]]
then
printf '%q ' "$@"
echo
else
if [[ ( "${force}" == "TRUE" ) || ( "${DRY_RUN}" != "TRUE" ) ]]
then
"$@"
fi
fi
}
@@ -185,24 +185,64 @@ 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
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 [[ ( "${force}" != "TRUE" ) && ( "${DUMP}" == "TRUE" ) ]]
then
printf 'bash -c %q\n' "${NAME}" "${caller}" "$1"
else
if [[ ( "${force}" == "TRUE" ) || ( "${DRY_RUN}" != "TRUE" ) ]]
then
bash -o errexit -o pipefail -o nounset -O extglob -c -- "$1" bash
fi
fi
}
#-----------------------------------------------------------------------------------------------------------------------------------
# Print
#-----------------------------------------------------------------------------------------------------------------------------------
print()
{
local inline="${1}"
shift
if [[ "${inline}" == "TRUE" ]]
then
str="%s"'\\n'
else
str="%s"'\n'
fi
if [[ "${DRY_RUN}" != "TRUE" ]]
then
bash -c -- "$1" bash
fi
cmd_exec printf "${str}" "$*"
}
@@ -216,10 +256,10 @@ sh_exec()
tab_assign()
{
declare -n ta_tab=$1
ta_key=$2
ta_value=$3
local ta_key=$2
local ta_value=$3
if [[ "${ta_value}" == "-" ]]
then
ta_value=""
@@ -239,8 +279,8 @@ tab_assign()
var_assign()
{
declare -n va_var=$1
va_value=$2
va_mode=$3
local va_value=$2
local va_mode=$3
if [[ "${va_value}" == "-" ]]
@@ -260,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}" ' <tr class="shade">'
else
print "${inline}" " <tr>"
fi
print "${inline}" " <th>${i}</th><td>${name}</td><td>${version}</td>"
if [[ "${VERBOSE}" == "TRUE" ]]
then
print "${inline}" "<td>${file}</td>"
fi
print "${inline}" " </tr>"
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
#--------------------------------------------------------------------------------------------------------------------------
@@ -331,7 +536,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
}
@@ -476,3 +681,13 @@ log_error()
{
log_print "${LOG_FILE}" "${LOG_LOCK}" "${LOG_ECHO}" "ERR" "$@"
}
#--------------------------------------------------------------------------------------------------------------------------
# Main
#--------------------------------------------------------------------------------------------------------------------------
vsl_add
+29 -52
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.2.0"
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;;
@@ -89,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
@@ -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
@@ -148,7 +149,6 @@ isl_version_print()
isl_help_print()
{
version_print
help_print
}
@@ -156,31 +156,6 @@ isl_help_print()
#-----------------------------------------------------------------------------------------------------------------------------------
# ISL Print
#-----------------------------------------------------------------------------------------------------------------------------------
isl_print()
{
local inline="$1"
if [[ "${inline}" == "TRUE" ]]
then
shift
str="%s"'\\n'
else
str="%s"'\n'
fi
cmd_exec printf "${str}" "$*"
}
#-----------------------------------------------------------------------------------------------------------------------------------
# ISL Add
#-----------------------------------------------------------------------------------------------------------------------------------
@@ -210,20 +185,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 +217,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
}
@@ -273,9 +248,9 @@ isl_html_dump()
if [[ $(( $i % 2)) -eq 0 ]]
then
isl_print "${inline}" ' <tr class="shade">'
print "${inline}" ' <tr class="shade">'
else
isl_print "${inline}" " <tr>"
print "${inline}" " <tr>"
fi
j=1
@@ -283,15 +258,15 @@ isl_html_dump()
do
if [[ "$j" == "1" ]]
then
isl_print "${inline}" " <th>${!j}</th>"
print "${inline}" " <th>${!j}</th>"
else
isl_print "${inline}" " <td>${!j}</td>"
print "${inline}" " <td>${!j}</td>"
fi
j=$(( $j + 1))
done
isl_print "${inline}" " </tr>"
print "${inline}" " </tr>"
i=$(( $i + 1))
done
}
@@ -310,7 +285,7 @@ isl_top()
local line=""
line=$( head -1 ${ISL_FILE})
line=$( head -1 "${ISL_FILE}")
if [[ "$?" != "0" ]]
then
@@ -320,9 +295,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
}
@@ -335,6 +310,8 @@ isl_top()
# Main
#-----------------------------------------------------------------------------------------------------------------------------------
vsl_add
orig_args=("$@")
isl_args_parse "$@"
@@ -372,8 +349,8 @@ case "${MODE}" in
isl_cat "${REVERSE}"
;;
"DUMP")
isl_dump "${REVERSE}" "${INLINE}"
"HTML-DUMP")
isl_html_dump "${REVERSE}" "${INLINE}"
;;
"TOP")
+51 -27
View File
@@ -28,7 +28,8 @@
# Includes
#-----------------------------------------------------------------------------------------------------------------------------------
. /usr/lib/rx3/base.bash
: "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/base.bash"
@@ -38,13 +39,11 @@
# Global Variables
#-----------------------------------------------------------------------------------------------------------------------------------
declare -g VERSION="1.0.0"
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 VERSION="1.2.1"
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] [ [ -D | --dump] | [-T | --test] ] [-u | --update] [-v | --verbose] ) ]"
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 MODE="DEFAULT"
@@ -53,18 +52,40 @@ declare -g MIRRORLIST_MGA=""
declare -g MIRRORLIST_RX3=""
declare -g UPDATE="FALSE"
declare -g RX3_CA_URL="http://www.rx3/rx3_root_ca.crt"
#-----------------------------------------------------------------------------------------------------------------------------------
# US Arg Parse
# 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
}
#-----------------------------------------------------------------------------------------------------------------------------------
# Arg 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
@@ -84,29 +105,30 @@ function us_args_parse()
-V|--version) MODE="VERSION"; shift;;
# Global options
-D|--dump) DUMP="TRUE"; shift;;
-T|--test) DRY_RUN="TRUE"; shift;;
-u|--update) UPDATE="TRUE"; shift;;
-v|--verbose) VERBOSE="TRUE"; shift;;
#
--) shift; break;;
*) echo_error "args_parse internal error [$1] !"; exit 1;;
*) echo_error "args_parse internal error [$1] !"; exit 1;;
esac
done
if [[ ${DISTRIB} == "" ]]
if [[ ( "${DUMP}" == "TRUE" ) && ( "${DRY_RUN}" == "TRUE" ) ]]
then
DISTRIB=${DISTRIB_DEF}
fi
echo_error "Dump cannot be enabled with Test!"
MODE="HELP";
EXIT_CODE=1
else
if [[ ${DISTRIB} == "" ]]
then
DISTRIB=${DISTRIB_DEF}
fi
if [[ "${MIRRORLIST_MGA}" == "" ]]
then
eval MIRRORLIST_MGA=\"${MIRRORLIST_MGA_DEF}\"
fi
if [[ "${MIRRORLIST_RX3}" == "" ]]
then
eval MIRRORLIST_RX3=\"${MIRRORLIST_RX3_DEF}\"
us_mirrorlist_init
fi
}
@@ -115,7 +137,7 @@ function us_args_parse()
#-----------------------------------------------------------------------------------------------------------------------------------
# US Version Print
# Version Print
#-----------------------------------------------------------------------------------------------------------------------------------
us_version_print()
@@ -128,12 +150,11 @@ us_version_print()
#-----------------------------------------------------------------------------------------------------------------------------------
# US Help Print
# Help Print
#-----------------------------------------------------------------------------------------------------------------------------------
us_help_print()
{
version_print
help_print
}
@@ -145,13 +166,14 @@ us_help_print()
# Main
#-----------------------------------------------------------------------------------------------------------------------------------
vsl_add
orig_args=("$@")
us_args_parse "$@"
case "${MODE}" in
case "${MODE}" in
"EXIT")
exit ${EXIT_CODE}
;;
@@ -168,8 +190,10 @@ 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}]"
echo_error "${NAME}: Mode: [${MODE}] Verbose: [${VERBOSE}] Dry_Run: [${DRY_RUN}] Distrib: [${DISTRIB}] MirrorList_MGA: [${MIRRORLIST_MGA}] MirrorList_RX3: [${MIRRORLIST_RX3}] Update: [${UPDATE}]"
cmd_exec curl ${RX3_CA_URL} >/etc/pki/ca-trust/source/anchors/rx3_root_ca.crt
cmd_exec update-ca-trust extract
cmd_exec urpmi.removemedia -a
cmd_exec rm -f /var/cache/urpmi/mirrors.cache
@@ -182,7 +206,7 @@ do
do
for type in "Release" "Updates"
do
cmd_exec urpmi.update --no-ignore "${media}" "${arch}${type}"
cmd_exec urpmi.update --no-ignore "${media} ${arch}${type}"
done
done
done
+61
View File
@@ -0,0 +1,61 @@
#!/bin/bash
#-----------------------------------------------------------------------------------------------------------------------------------
#
# URPMI Setup CGI
#
# Copyright (C) 2026 Arnaud G. GIBERT
# mailto:arnaud@rx3.net
#
# This is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; If not, see
# <https://www.gnu.org/licenses/>.
#
#-----------------------------------------------------------------------------------------------------------------------------------
#-----------------------------------------------------------------------------------------------------------------------------------
# Includes
#-----------------------------------------------------------------------------------------------------------------------------------
: "${RX3_LIB_DIR:=/usr/lib/rx3}"
. "${RX3_LIB_DIR}/docker_tools.bash"
#-----------------------------------------------------------------------------------------------------------------------------------
# Main
#-----------------------------------------------------------------------------------------------------------------------------------
echo "Content-type: text/plain"
echo ""
if [[ -n "${QUERY_STRING}" ]]
then
if [[ "$QUERY_STRING" =~ ^[a-z0-9]+$ ]]
then
DISTRIB_OPT="-d ${QUERY_STRING}"
else
echo "Error: Invalid characters in query string."
exit 1
fi
else
DISTRIB_OPT=""
fi
urpmi-setup -v -D ${DISTRIB_OPT}