Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 42ea9e4bf7 | |||
| 3080925ce5 | |||
| 686d8642c1 |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*~
|
||||||
|
*.old
|
||||||
@@ -1,5 +1,34 @@
|
|||||||
------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
MPM V 1.0.0-1 - A. GIBERT - 2024/10/04
|
MPM V 1.1.2 - A. GIBERT - 2026/04/20
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- Migrate to rx3 base library.
|
||||||
|
- Support rx3-base 1.1.2.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
MPM V 1.1.1 - A. GIBERT - 2026/03/21
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- Add bash completion support,
|
||||||
|
- Fix html file location.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
MPM V 1.1.0 - A. GIBERT - 2026/03/14
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- Add local repo support,
|
||||||
|
- Add MariaDB meta package,
|
||||||
|
- New args parsing system with test and verbose options,
|
||||||
|
- Add RPM Specs file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
MPM V 1.0.0 - A. GIBERT - 2024/10/04
|
||||||
------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
- Initial release: help, list & install commands implemented.
|
- Initial release: help, list & install commands implemented.
|
||||||
|
|||||||
155
SPECS/mpm.spec
Normal file
155
SPECS/mpm.spec
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# MPM (Meta Package Manager)
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024-2026 Arnaud G. GIBERT
|
||||||
|
# mailto:arnaud@rx3.net
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or 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, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%define name mpm
|
||||||
|
%define version 1.1.2
|
||||||
|
%define release %mkrel 1rx3
|
||||||
|
|
||||||
|
%global debug_package %{nil}
|
||||||
|
|
||||||
|
%global _webdir %{_localstatedir}/www
|
||||||
|
%global _webcgi %{_webdir}/cgi-bin
|
||||||
|
%global _webhtml %{_webdir}/html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Name: %{name}
|
||||||
|
Version: %{version}
|
||||||
|
Release: %{release}
|
||||||
|
Summary: Meta Package Manager - Client tool
|
||||||
|
License: GPL
|
||||||
|
URL: https://git.rx3.org/gitea/rx3/%{name}
|
||||||
|
|
||||||
|
Source0: https://git.rx3.org/gitea/rx3/%{name}/archive/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
|
Distribution: Rx3 Free Software
|
||||||
|
Vendor: Rx3
|
||||||
|
Packager: Arnaud G. GIBERT <arnaud@rx3.net>
|
||||||
|
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
%description
|
||||||
|
MPM is a Meta Package Manager, based upon URPMI and RPM packages.
|
||||||
|
This is the client tool.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%package server
|
||||||
|
Summary: Meta Package Manager - Server repository
|
||||||
|
Requires: apache
|
||||||
|
|
||||||
|
%description server
|
||||||
|
MPM is a Meta Package Manager, based upon URPMI and RPM packages.
|
||||||
|
This is the server repository.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Prep
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n %{name}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Build
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%build
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Install
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%install
|
||||||
|
# Client
|
||||||
|
install -D -pm 644 etc/%{name}.conf %{buildroot}%{_sysconfdir}/%{name}.conf
|
||||||
|
install -D -pm 644 etc/bash_completion.d/%{name} %{buildroot}%{_sysconfdir}/bash_completion.d/%{name}
|
||||||
|
install -D -pm 755 sbin/%{name} %{buildroot}%{_sbindir}/%{name}
|
||||||
|
|
||||||
|
# Server
|
||||||
|
cd www/html/%{name}-repository
|
||||||
|
for file in *.mpm
|
||||||
|
do
|
||||||
|
install -D -pm 644 ${file} %{buildroot}%{_webhtml}/%{name}-repository/${file}
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Check
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%check
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Files
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%files
|
||||||
|
%doc ReadMe.txt ReleaseNotes.txt ToDo.txt
|
||||||
|
%license GNU_GPL-3.0.txt
|
||||||
|
%config(noreplace) %{_sysconfdir}/%{name}.conf
|
||||||
|
%{_sysconfdir}/bash_completion.d/%{name}
|
||||||
|
%{_sbindir}/%{name}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%files server
|
||||||
|
%{_webhtml}/%{name}-repository/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# ChangeLog
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon Apr 20 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.1.2-1rx3.mga9
|
||||||
|
- Update to 1.1.2
|
||||||
|
|
||||||
|
* Sat Mar 21 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.1.1-1rx3.mga9
|
||||||
|
- Update to 1.1.1
|
||||||
|
- Add bash completion support
|
||||||
|
- Fix html file location
|
||||||
|
|
||||||
|
* Sat Mar 14 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.1.0-1rx3.mga9
|
||||||
|
- Create initial SPEC file for 1.1.0 on Mageia 9
|
||||||
95
etc/bash_completion.d/mpm
Normal file
95
etc/bash_completion.d/mpm
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# MPM (Meta Package Manager) Bash Completion
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024-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 Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
|
# License along with this program; If not, see
|
||||||
|
# <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# MPM Completion
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
_mpm_completion()
|
||||||
|
{
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
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 i
|
||||||
|
|
||||||
|
COMPREPLY=()
|
||||||
|
|
||||||
|
# Count non-option positional arguments already provided
|
||||||
|
for (( i=1; i<COMP_CWORD; i++ ))
|
||||||
|
do
|
||||||
|
case "${COMP_WORDS[i]}" in
|
||||||
|
-h|--help|-V|--version|-v|--verbose|-T|--test|-l|--list)
|
||||||
|
;;
|
||||||
|
-i|--install|-r|--repo)
|
||||||
|
i=$(( i + 1 ))
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
pos=$(( pos + 1 ))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Complete options if current word starts with '-'
|
||||||
|
if [[ "${cur}" == -* ]]
|
||||||
|
then
|
||||||
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Complete based on previous option
|
||||||
|
case "${prev}" in
|
||||||
|
-i|--install)
|
||||||
|
local mpm_names
|
||||||
|
mpm_names="$(mpm --list 2>/dev/null | awk 'NR>2 { gsub(/^ +/, "", $1); print $1 }')"
|
||||||
|
COMPREPLY=( $(compgen -W "${mpm_names}" -- "${cur}") )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-r|--repo)
|
||||||
|
COMPREPLY=()
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Complete positional arguments
|
||||||
|
case "${pos}" in
|
||||||
|
0)
|
||||||
|
COMPREPLY=( $(compgen -W "-h --help -V --version -v --verbose -T --test -l --list -i --install -r --repo" -- "${cur}") )
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=()
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
complete -o filenames -F _mpm_completion mpm
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
#-------------------------------------------------------------------------------#
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# MPM (Meta Package Manager)
|
# MPM (Meta Package Manager)
|
||||||
# Copyright (C) 2024 Arnaud G. GIBERT
|
#
|
||||||
|
# Copyright (C) 2024-2026 Arnaud G. GIBERT
|
||||||
# mailto:arnaud@rx3.net
|
# mailto:arnaud@rx3.net
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
@@ -18,7 +19,7 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
# Default MPM repository
|
# Default MPM repository
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
#-------------------------------------------------------------------------------#
|
|
||||||
#
|
|
||||||
# MPM (Meta Package Manager)
|
|
||||||
# Copyright (C) 2024 Arnaud G. GIBERT
|
|
||||||
# mailto:arnaud@rx3.net
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU General Public License
|
|
||||||
# as published by the Free Software Foundation; either version 2
|
|
||||||
# of the License, or 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, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
# Default MPM repository
|
|
||||||
MPM_REPO="https://www.rx3.net/mpm-repository"
|
|
||||||
304
sbin/mpm
304
sbin/mpm
@@ -1,203 +1,309 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#-------------------------------------------------------------------------------#
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# MPM (Meta Package Manager)
|
# MPM (Meta Package Manager)
|
||||||
# Copyright (C) 2024 Arnaud G. GIBERT
|
#
|
||||||
|
# Copyright (C) 2024-2026 Arnaud G. GIBERT
|
||||||
# mailto:arnaud@rx3.net
|
# mailto:arnaud@rx3.net
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This is free software: you can redistribute it and/or modify it
|
||||||
# modify it under the terms of the GNU General Public License
|
# under the terms of the GNU Lesser General Public License as published
|
||||||
# as published by the Free Software Foundation; either version 2
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
# of the License, or any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
# along with this program; if not, write to the Free Software
|
# License along with this program; If not, see
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
# <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
command="$1"
|
|
||||||
arg="$2"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Includes
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
: "${RX3_LIB_DIR:=/usr/lib/rx3}"
|
||||||
|
. "${RX3_LIB_DIR}/base.bash"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Global Variables
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
declare -g VERSION="1.1.2"
|
||||||
|
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 MODE="DEFAULT"
|
||||||
|
declare -g VERBOSE="FALSE"
|
||||||
|
declare -g DRY_RUN="FALSE"
|
||||||
|
declare -g RETVAL=0
|
||||||
|
|
||||||
|
declare -g MPM_REPO="https://www.rx3.net/mpm-repository"
|
||||||
|
declare -g MPM_NAME=""
|
||||||
|
|
||||||
if [[ -f /etc/mpm.conf ]]
|
if [[ -f /etc/mpm.conf ]]
|
||||||
then
|
then
|
||||||
. /etc/mpm.conf
|
. /etc/mpm.conf
|
||||||
else
|
|
||||||
MPM_REPO="https://www.rx3.net/mpm-repository"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERSION=1.0.0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# MPM Help
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function mpm_help()
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Version Print
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mpm_version_print()
|
||||||
{
|
{
|
||||||
echo "MPM Version: [${VERSION}]"
|
version_print
|
||||||
echo "Repository URL: [${MPM_REPO}]"
|
|
||||||
echo "usage: mpm [--help | -h] | [--list | -l] | [--install | -i <mpm_name>]"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# MPM Meta Package List
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function mpm_mpkg_list()
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Help Print
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mpm_help_print()
|
||||||
{
|
{
|
||||||
echo "$(curl -L 2>/dev/null "${MPM_REPO}" | grep -e '\.mpm</a>' | sed -e 's/.*href="//' -e 's/\.mpm".*//')"
|
mpm_version_print
|
||||||
|
echo_error "Repository URL: [${MPM_REPO}]"
|
||||||
|
help_print
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# MPM Meta Package Tag Read
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function mpm_mpkg_tag_read()
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Arg Parse
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mpm_args_parse()
|
||||||
{
|
{
|
||||||
mpkg="$1"
|
tmp_args=$(getopt -o hi:lr:TvV --long help,install:,list,repo:,test,verbose,version -n "${NAME}" -- "$@")
|
||||||
tag="$2"
|
|
||||||
|
|
||||||
echo "$(curl -L 2>/dev/null "${MPM_REPO}/${mpkg}.mpm" | grep -e "${tag}: " | sed -e "s/^${tag}: //")"
|
if [ $? != 0 ]; then echo_error "Terminating..." >&2; exit 1; fi
|
||||||
|
|
||||||
|
eval set -- "${tmp_args}"
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
# Path options
|
||||||
|
-r|--repo) MPM_REPO="$2"; shift; shift;;
|
||||||
|
|
||||||
|
# Mode switches
|
||||||
|
-h|--help) MODE="EXIT"; mpm_help_print; shift;;
|
||||||
|
-i|--install) MODE="INSTALL"; MPM_NAME="$2"; shift; shift;;
|
||||||
|
-l|--list) MODE="LIST"; shift;;
|
||||||
|
-V|--version) MODE="EXIT"; mpm_version_print; shift;;
|
||||||
|
|
||||||
|
# Global options
|
||||||
|
-T|--test) DRY_RUN="TRUE"; shift;;
|
||||||
|
-v|--verbose) VERBOSE="TRUE"; shift;;
|
||||||
|
|
||||||
|
# End of options
|
||||||
|
--) shift; break;;
|
||||||
|
*) echo_error "args_parse internal error [$1]!"; exit 1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${MODE}" == "DEFAULT" ]]
|
||||||
|
then
|
||||||
|
MODE="EXIT"
|
||||||
|
|
||||||
|
echo_error "Help, Install, List or Version should be invoked!"
|
||||||
|
mpm_help_print
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# MPM Meta Package Description
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function mpm_mpkg_desc()
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Meta Package List
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mpm_mpkg_list()
|
||||||
{
|
{
|
||||||
mpkg="$1"
|
if [[ "${MPM_REPO}" =~ ^https?:// ]]
|
||||||
|
then
|
||||||
|
cmd_exec curl -L "${MPM_REPO}" 2>/dev/null | grep -e '\.mpm</a>' | sed -e 's/.*href="//' -e 's/\.mpm".*//'
|
||||||
|
else
|
||||||
|
ls "${MPM_REPO}"/*.mpm | sed -e "s%^${MPM_REPO}/%%" -e 's/\.mpm$//'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Meta Package Tag Read
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mpm_mpkg_tag_read()
|
||||||
|
{
|
||||||
|
local mpkg="$1"
|
||||||
|
local tag="$2"
|
||||||
|
|
||||||
|
if [[ "${MPM_REPO}" =~ ^https?:// ]]
|
||||||
|
then
|
||||||
|
cmd_exec curl -L "${MPM_REPO}/${mpkg}.mpm" 2>/dev/null | grep -e "${tag}: " | sed -e "s/^${tag}: //"
|
||||||
|
else
|
||||||
|
grep -e "${tag}: " "${MPM_REPO}/${mpkg}.mpm" 2>/dev/null | sed -e "s/^${tag}: //"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Meta Package Description
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mpm_mpkg_desc()
|
||||||
|
{
|
||||||
|
local mpkg="$1"
|
||||||
|
|
||||||
mpm_mpkg_tag_read "${mpkg}" "PKG_DESC"
|
mpm_mpkg_tag_read "${mpkg}" "PKG_DESC"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# MPM Meta Package List
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function mpm_mpkg_pkglist()
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Meta Package Package List
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mpm_mpkg_pkglist()
|
||||||
{
|
{
|
||||||
mpkg="$1"
|
local mpkg="$1"
|
||||||
|
|
||||||
mpm_mpkg_tag_read "${mpkg}" "PKG_LIST"
|
mpm_mpkg_tag_read "${mpkg}" "PKG_LIST"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# MPM List
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function mpm_list()
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# List
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mpm_list()
|
||||||
{
|
{
|
||||||
echo " MPM Name + MPM Description + Package List "
|
local mpkg
|
||||||
echo "--------------------+---------------------------------+------------------------------------------------"
|
local desc
|
||||||
|
local pkglist
|
||||||
|
|
||||||
mpm_mpkg_list | while read mpkg
|
echo " MPM Name | MPM Description | Package List "
|
||||||
|
echo "---------------------+----------------------------------+---------------------------------------------------------------------------"
|
||||||
|
|
||||||
|
mpm_mpkg_list | while read -r mpkg
|
||||||
do
|
do
|
||||||
desc="$(mpm_mpkg_desc $mpkg)"
|
desc="$(mpm_mpkg_desc "${mpkg}")"
|
||||||
pkglist="$(mpm_mpkg_pkglist $mpkg)"
|
pkglist="$(mpm_mpkg_pkglist "${mpkg}")"
|
||||||
|
|
||||||
printf "%20s: %-32s [%s]\n" "${mpkg}" "${desc}" "${pkglist}"
|
printf "%20s | %-32s | %s\n" "${mpkg}" "${desc}" "${pkglist}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# MPM Install
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function mpm_install
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Install
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mpm_install()
|
||||||
{
|
{
|
||||||
mpkg=$1
|
local mpkg="$1"
|
||||||
|
local pkglist
|
||||||
|
|
||||||
|
|
||||||
if [[ "${mpkg}" == "" ]]
|
if [[ "${mpkg}" == "" ]]
|
||||||
then
|
then
|
||||||
echo "missing required mpkg name"
|
echo_error "Missing required mpkg name!"
|
||||||
mpm_help
|
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mpm_mpkg_list | grep -qe "^${mpkg}$" -e "^${mpkg} " -e " ${mpkg}$" -e " ${mpkg} "
|
||||||
|
|
||||||
mpm_mpkg_list | grep -e "^${mpkg}$" -e "^${mpkg} " -e " ${mpkg}$" -e " ${mpkg} " 2>&1 >/dev/null
|
if [[ "$?" == "1" ]]
|
||||||
|
|
||||||
if [[ "$?" == 1 ]]
|
|
||||||
then
|
then
|
||||||
echo "mpkg [${mpkg}] not found!"
|
echo_error "mpkg [${mpkg}] not found!"
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
pkglist="$(mpm_mpkg_pkglist "${mpkg}")"
|
||||||
pkglist="$(mpm_mpkg_pkglist $mpkg)"
|
|
||||||
|
|
||||||
if [[ "${pkglist}" == "" ]]
|
if [[ "${pkglist}" == "" ]]
|
||||||
then
|
then
|
||||||
echo "package list is empty!"
|
echo_error "Package list is empty!"
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "installing MPM: [$mpkg]:[${pkglist}]"
|
echo "Installing MPM: [${mpkg}]:[${pkglist}]"
|
||||||
|
|
||||||
urpmi --force ${pkglist}
|
cmd_exec urpmi --force ${pkglist}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# MPM Main
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
case "${command}"
|
|
||||||
in
|
|
||||||
"--help" | "-h")
|
|
||||||
mpm_help
|
|
||||||
;;
|
|
||||||
|
|
||||||
"--list" | "-l")
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Main
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mpm_args_parse "$@"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [[ "${MODE}" == "EXIT" ]]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo_error "Mode: [${MODE}] Verbose: [${VERBOSE}] Dry_Run: [${DRY_RUN}] Repo_URL: [${MPM_REPO}]"
|
||||||
|
|
||||||
|
case "${MODE}" in
|
||||||
|
LIST)
|
||||||
mpm_list
|
mpm_list
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--install" | "-i")
|
INSTALL)
|
||||||
mpm_install $arg
|
mpm_install "${MPM_NAME}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
if [[ "${command}" == "" ]]
|
mpm_help_print
|
||||||
then
|
RETVAL=1
|
||||||
echo "missing mandatory command!"
|
|
||||||
else
|
|
||||||
|
|
||||||
echo "unknown command [${command}]!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
mpm_help
|
|
||||||
|
|
||||||
exit 1
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit 0
|
exit ${RETVAL}
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
#
|
|
||||||
PKG_DESC: Emacs No X-Windows
|
|
||||||
PKG_LIST: emacs-nox hunspell-en
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#
|
|
||||||
PKG_DESC: Emacs with X-Windows
|
|
||||||
PKG_LIST: emacs lib64vulkan-loader1 lib64jack0 lib64opencl1 pipewire-media-session lib64proxy-webkit hunspell-en
|
|
||||||
3
www/html/mpm-repository/mariadb.mpm
Normal file
3
www/html/mpm-repository/mariadb.mpm
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# MariaDB MPM
|
||||||
|
PKG_DESC: MariaDB/MySQL Client
|
||||||
|
PKG_LIST: mariadb-client
|
||||||
3
www/html/mpm-repository/net_tools.mpm
Normal file
3
www/html/mpm-repository/net_tools.mpm
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#
|
||||||
|
PKG_DESC: Network tools for investigations
|
||||||
|
PKG_LIST: net-tools bind-utils netkit-telnet tcpdump
|
||||||
3
www/html/mpm-repository/postgres.mpm
Normal file
3
www/html/mpm-repository/postgres.mpm
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# PostgreSQL MPM
|
||||||
|
PKG_DESC: PostgreSQL Client
|
||||||
|
PKG_LIST: postgresql15
|
||||||
Reference in New Issue
Block a user