- 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 a4b01d3759
6 changed files with 124 additions and 55 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,13 +39,11 @@
# Global Variables
#-----------------------------------------------------------------------------------------------------------------------------------
declare -g VERSION="1.0.0"
declare -g VERSION="1.0.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] [-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 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"
@@ -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()
{
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,6 +103,7 @@ 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;;
@@ -94,19 +114,19 @@ function us_args_parse()
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 +135,7 @@ function us_args_parse()
#-----------------------------------------------------------------------------------------------------------------------------------
# US Version Print
# Version Print
#-----------------------------------------------------------------------------------------------------------------------------------
us_version_print()
@@ -128,7 +148,7 @@ us_version_print()
#-----------------------------------------------------------------------------------------------------------------------------------
# US Help Print
# 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 rm -f /var/cache/urpmi/mirrors.cache
@@ -182,7 +202,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