2 Commits

Author SHA1 Message Date
f45abae0ce - Add VSL support,
- Fix dry run,
- Support now rx3-base 1.2.0.
2026-09-13 16:57:07 +02:00
a0f2ffa0cf - Improve Bash completion to suggest meta-packages after -i or --install options. 2026-06-20 17:57:17 +02:00
5 changed files with 97 additions and 65 deletions

View File

@@ -1,4 +1,4 @@
Welcome to MPM: Meta Package Manager 1.0.x ! Welcome to MPM: Meta Package Manager 1.1.x !

View File

@@ -1,3 +1,21 @@
------------------------------------------------------------------------------------------------------------------------------------
MPM V 1.1.4 - A. GIBERT - 2026/09/13
------------------------------------------------------------------------------------------------------------------------------------
- Add VSL support,
- Fix dry run,
- Support now rx3-base 1.2.0.
------------------------------------------------------------------------------------------------------------------------------------
MPM V 1.1.3 - A. GIBERT - 2026/06/20
------------------------------------------------------------------------------------------------------------------------------------
- Improve Bash completion to suggest meta-packages after -i or --install options.
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
MPM V 1.1.2 - A. GIBERT - 2026/05/03 MPM V 1.1.2 - A. GIBERT - 2026/05/03
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
@@ -32,5 +50,3 @@ MPM V 1.0.0 - A. GIBERT - 2024/10/04
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
- Initial release: help, list & install commands implemented. - Initial release: help, list & install commands implemented.

View File

@@ -24,7 +24,7 @@
%define name mpm %define name mpm
%define version 1.1.2 %define version 1.1.4
%define release %mkrel 1rx3 %define release %mkrel 1rx3
%global debug_package %{nil} %global debug_package %{nil}
@@ -160,6 +160,12 @@ done
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
%changelog %changelog
* Sun Sep 13 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.1.4-1rx3.mga9
- Update to 1.1.4
* Sat Jun 20 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 * Sun May 3 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.1.2-1rx3.mga9
- Update to 1.1.2 - Update to 1.1.2

View File

@@ -28,46 +28,42 @@
_mpm_completion() _mpm_completion()
{ {
local mode_opts="-h --help -V --version -l --list -i --install"
local glob_opts="-T --test -v --verbose -r --repo"
local cur="${COMP_WORDS[COMP_CWORD]}" local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}" local prev="${COMP_WORDS[COMP_CWORD-1]}"
local opts="-h --help -V --version -v --verbose -T --test -l --list -i --install -r --repo"
local pos=0 local mode_set="FALSE"
local repo=""
local i local i
COMPREPLY=() COMPREPLY=()
# Count non-option positional arguments already provided # Scan already provided words to detect mode and repo override
for (( i=1; i<COMP_CWORD; i++ )) for (( i=1; i<COMP_CWORD; i++ ))
do do
case "${COMP_WORDS[i]}" in case "${COMP_WORDS[i]}" in
-h|--help|-V|--version|-v|--verbose|-T|--test|-l|--list) -h|--help|-V|--version|-l|--list|-i|--install)
mode_set="TRUE"
;; ;;
-i|--install|-r|--repo) -r|--repo)
i=$(( i + 1 )) repo="${COMP_WORDS[i+1]}"
;;
--)
;;
-*)
;;
*)
pos=$(( pos + 1 ))
;; ;;
esac esac
done done
# Complete options if current word starts with '-' # Complete the argument of -i / --install with the live package list
if [[ "${cur}" == -* ]]
then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
# Complete based on previous option
case "${prev}" in case "${prev}" in
-i|--install) -i|--install)
local mpm_names local mpm_names
if [[ "${repo}" != "" ]]
then
mpm_names="$(mpm -r "${repo}" --list 2>/dev/null | awk 'NR>2 { gsub(/^ +/, "", $1); print $1 }')"
else
mpm_names="$(mpm --list 2>/dev/null | awk 'NR>2 { gsub(/^ +/, "", $1); print $1 }')" mpm_names="$(mpm --list 2>/dev/null | awk 'NR>2 { gsub(/^ +/, "", $1); print $1 }')"
fi
COMPREPLY=( $(compgen -W "${mpm_names}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${mpm_names}" -- "${cur}") )
return 0 return 0
;; ;;
@@ -77,15 +73,13 @@ _mpm_completion()
;; ;;
esac esac
# Complete positional arguments # Build candidate list depending on whether a mode is already set
case "${pos}" in if [[ "${mode_set}" == "TRUE" ]]
0) then
COMPREPLY=( $(compgen -W "-h --help -V --version -v --verbose -T --test -l --list -i --install -r --repo" -- "${cur}") ) COMPREPLY=( $(compgen -W "${glob_opts}" -- "${cur}") )
;; else
*) COMPREPLY=( $(compgen -W "${mode_opts} ${glob_opts}" -- "${cur}") )
COMPREPLY=() fi
;;
esac
return 0 return 0
} }

View File

@@ -39,14 +39,14 @@
# Global Variables # Global Variables
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
declare -g VERSION="1.1.2" declare -g VERSION="1.1.4"
declare -g NAME="mpm" declare -g NAME="MPM"
declare -g HELP="usage: [-h | --help] | [-V | --version] | [-l | --list] | [-i | --install <mpm_name>] [-T | --test] [-v | --verbose] [-r | --repo <repository_url>]" declare -g HELP="usage: [-h | --help] | [-V | --version] | [-l | --list] | [-i | --install <mpm_name>] [-T | --test] [-v | --verbose] [-r | --repo <repository_url>]"
declare -g EXIT_CODE=0
declare -g MODE="DEFAULT" declare -g MODE="DEFAULT"
declare -g VERBOSE="FALSE" declare -g VERBOSE="FALSE"
declare -g DRY_RUN="FALSE" declare -g DRY_RUN="FALSE"
declare -g RETVAL=0
declare -g MPM_REPO="https://www.rx3.net/mpm-repository" declare -g MPM_REPO="https://www.rx3.net/mpm-repository"
declare -g MPM_NAME="" declare -g MPM_NAME=""
@@ -79,9 +79,8 @@ mpm_version_print()
mpm_help_print() mpm_help_print()
{ {
mpm_version_print
echo_error "Repository URL: [${MPM_REPO}]"
help_print help_print
echo_error "Repository URL: [${MPM_REPO}]"
} }
@@ -107,10 +106,10 @@ mpm_args_parse()
-r|--repo) MPM_REPO="$2"; shift; shift;; -r|--repo) MPM_REPO="$2"; shift; shift;;
# Mode switches # Mode switches
-h|--help) MODE="EXIT"; mpm_help_print; shift;; -h|--help) MODE="HELP"; shift;;
-i|--install) MODE="INSTALL"; MPM_NAME="$2"; shift; shift;; -i|--install) MODE="INSTALL"; MPM_NAME="$2"; shift; shift;;
-l|--list) MODE="LIST"; shift;; -l|--list) MODE="LIST"; shift;;
-V|--version) MODE="EXIT"; mpm_version_print; shift;; -V|--version) MODE="VERSION"; shift;;
# Global options # Global options
-T|--test) DRY_RUN="TRUE"; shift;; -T|--test) DRY_RUN="TRUE"; shift;;
@@ -124,12 +123,10 @@ mpm_args_parse()
if [[ "${MODE}" == "DEFAULT" ]] if [[ "${MODE}" == "DEFAULT" ]]
then then
MODE="EXIT"
echo_error "Help, Install, List or Version should be invoked!" echo_error "Help, Install, List or Version should be invoked!"
mpm_help_print
exit 1 MODE="HELP"
EXIT_CODE=1
fi fi
} }
@@ -145,7 +142,7 @@ mpm_mpkg_list()
{ {
if [[ "${MPM_REPO}" =~ ^https?:// ]] if [[ "${MPM_REPO}" =~ ^https?:// ]]
then then
cmd_exec curl -L "${MPM_REPO}" 2>/dev/null | grep -e '\.mpm</a>' | sed -e 's/.*href="//' -e 's/\.mpm".*//' cmd_exec FORCE curl -L "${MPM_REPO}" 2>/dev/null | grep -e '\.mpm</a>' | sed -e 's/.*href="//' -e 's/\.mpm".*//'
else else
ls "${MPM_REPO}"/*.mpm | sed -e "s%^${MPM_REPO}/%%" -e 's/\.mpm$//' ls "${MPM_REPO}"/*.mpm | sed -e "s%^${MPM_REPO}/%%" -e 's/\.mpm$//'
fi fi
@@ -164,9 +161,10 @@ mpm_mpkg_tag_read()
local mpkg="$1" local mpkg="$1"
local tag="$2" local tag="$2"
if [[ "${MPM_REPO}" =~ ^https?:// ]] if [[ "${MPM_REPO}" =~ ^https?:// ]]
then then
cmd_exec curl -L "${MPM_REPO}/${mpkg}.mpm" 2>/dev/null | grep -e "${tag}: " | sed -e "s/^${tag}: //" cmd_exec FORCE curl -L "${MPM_REPO}/${mpkg}.mpm" 2>/dev/null | grep -e "${tag}: " | sed -e "s/^${tag}: //"
else else
grep -e "${tag}: " "${MPM_REPO}/${mpkg}.mpm" 2>/dev/null | sed -e "s/^${tag}: //" grep -e "${tag}: " "${MPM_REPO}/${mpkg}.mpm" 2>/dev/null | sed -e "s/^${tag}: //"
fi fi
@@ -184,6 +182,7 @@ mpm_mpkg_desc()
{ {
local mpkg="$1" local mpkg="$1"
mpm_mpkg_tag_read "${mpkg}" "PKG_DESC" mpm_mpkg_tag_read "${mpkg}" "PKG_DESC"
} }
@@ -199,6 +198,7 @@ mpm_mpkg_pkglist()
{ {
local mpkg="$1" local mpkg="$1"
mpm_mpkg_tag_read "${mpkg}" "PKG_LIST" mpm_mpkg_tag_read "${mpkg}" "PKG_LIST"
} }
@@ -216,6 +216,7 @@ mpm_list()
local desc local desc
local pkglist local pkglist
echo " MPM Name | MPM Description | Package List " echo " MPM Name | MPM Description | Package List "
echo "---------------------+----------------------------------+---------------------------------------------------------------------------" echo "---------------------+----------------------------------+---------------------------------------------------------------------------"
@@ -280,17 +281,31 @@ mpm_install()
# Main # Main
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
vsl_add
mpm_args_parse "$@" mpm_args_parse "$@"
case "${MODE}" in
"EXIT")
exit ${EXIT_CODE}
;;
"HELP")
mpm_help_print
exit ${EXIT_CODE}
;;
"VERSION")
mpm_version_print
exit ${EXIT_CODE}
;;
esac
if [[ "${MODE}" == "EXIT" ]]
then
exit 0
fi
echo_error "Mode: [${MODE}] Verbose: [${VERBOSE}] Dry_Run: [${DRY_RUN}] Repo_URL: [${MPM_REPO}]" echo_error "Mode: [${MODE}] Verbose: [${VERBOSE}] Dry_Run: [${DRY_RUN}] Repo_URL: [${MPM_REPO}]"
case "${MODE}" in case "${MODE}" in
LIST) LIST)
mpm_list mpm_list
@@ -302,8 +317,9 @@ case "${MODE}" in
*) *)
mpm_help_print mpm_help_print
RETVAL=1 EXIT_CODE=1
;; ;;
esac esac
exit ${RETVAL}
exit ${EXIT_CODE}