- Add local repo support,
- Add MariaDB meta package, - New args parsing system with test and verbose options, - Add RPM Specs file.
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*~
|
||||||
|
*.old
|
||||||
@@ -1,5 +1,16 @@
|
|||||||
------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
MPM V 1.0.0-1 - A. GIBERT - 2024/10/04
|
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.
|
||||||
|
|||||||
120
SPECS/mpm.spec
Normal file
120
SPECS/mpm.spec
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
%define name mpm
|
||||||
|
%define version 1.1.0
|
||||||
|
%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 755 sbin/%{name} %{buildroot}%{_sbindir}/%{name}
|
||||||
|
|
||||||
|
# Server
|
||||||
|
cd var/www/%{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
|
||||||
|
%{_sbindir}/%{name}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%files server
|
||||||
|
%{_webhtml}/%{name}-repository/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# ChangeLog
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* 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
|
||||||
@@ -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"
|
|
||||||
225
sbin/mpm
225
sbin/mpm
@@ -2,7 +2,7 @@
|
|||||||
#-------------------------------------------------------------------------------#
|
#-------------------------------------------------------------------------------#
|
||||||
#
|
#
|
||||||
# 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
|
||||||
@@ -33,51 +33,162 @@ else
|
|||||||
MPM_REPO="https://www.rx3.net/mpm-repository"
|
MPM_REPO="https://www.rx3.net/mpm-repository"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERSION=1.0.0
|
VERSION=1.1.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# MPM Help
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function mpm_help()
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Exec CMD
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
exec_cmd()
|
||||||
{
|
{
|
||||||
echo "MPM Version: [${VERSION}]"
|
cmd="$1"
|
||||||
echo "Repository URL: [${MPM_REPO}]"
|
|
||||||
echo "usage: mpm [--help | -h] | [--list | -l] | [--install | -i <mpm_name>]"
|
|
||||||
|
if [[ "${verbose}" == "true" ]]
|
||||||
|
then
|
||||||
|
echo "${cmd}" 1>&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${dry_run}" != "true" ]]
|
||||||
|
then
|
||||||
|
eval "${cmd}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# MPM Help
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function mpm_version_print()
|
||||||
|
{
|
||||||
|
echo "MPM Version: [${VERSION}]"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# MPM Help
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function mpm_help_print()
|
||||||
|
{
|
||||||
|
mpm_version_print
|
||||||
|
echo "Repository URL: [${MPM_REPO}]"
|
||||||
|
echo "usage: mpm [-h | --help] | [-V | --version] | [-l | --list] | [-i | --install <mpm_name>] [-T | --test] [-v | --verbose] [-r | --repo <repository_url>]"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
# Arg Parse
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function mpm_args_parse()
|
||||||
|
{
|
||||||
|
mode="default"
|
||||||
|
verbose="false"
|
||||||
|
dry_run="false"
|
||||||
|
|
||||||
|
|
||||||
|
tmp_args=$(getopt -o hi:lr:TvV --long help,install:,list,repo:,test,verbose,version -- "$@")
|
||||||
|
|
||||||
|
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
||||||
|
|
||||||
|
# Note the quotes around `$tmp_args': they are essential!
|
||||||
|
eval set -- "${tmp_args}"
|
||||||
|
|
||||||
|
while true ; do
|
||||||
|
case "$1" in
|
||||||
|
# Path options
|
||||||
|
-r|--repo) shift; MPM_REPO="$1"; shift;;
|
||||||
|
|
||||||
|
# Options
|
||||||
|
|
||||||
|
# Mode switches
|
||||||
|
-h|--help) mode="exit"; mpm_help_print; shift;;
|
||||||
|
-i|--install) shift; mode="install"; mpm_name="$1"; 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;;
|
||||||
|
|
||||||
|
#
|
||||||
|
--) shift; break;;
|
||||||
|
*) echo "args_parse internal error [$1] !"; exit 1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${mode}" == "default" ]]
|
||||||
|
then
|
||||||
|
echo "Help, Install, List or Version should invoked!"
|
||||||
|
|
||||||
|
mode="exit"
|
||||||
|
mpm_help_print
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
# MPM Meta Package List
|
# MPM Meta Package List
|
||||||
#-------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function mpm_mpkg_list()
|
function mpm_mpkg_list()
|
||||||
{
|
{
|
||||||
echo "$(curl -L 2>/dev/null "${MPM_REPO}" | grep -e '\.mpm</a>' | sed -e 's/.*href="//' -e 's/\.mpm".*//')"
|
if [[ "${MPM_REPO}" =~ ^https?:// ]]
|
||||||
|
then
|
||||||
|
echo "$(curl -L 2>/dev/null "${MPM_REPO}" | grep -e '\.mpm</a>' | sed -e 's/.*href="//' -e 's/\.mpm".*//')"
|
||||||
|
else
|
||||||
|
echo "$(ls ${MPM_REPO}/*.mpm | sed -e "s%^${MPM_REPO}/%%" -e 's/\.mpm$//')"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
# MPM Meta Package Tag Read
|
# MPM Meta Package Tag Read
|
||||||
#-------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function mpm_mpkg_tag_read()
|
function mpm_mpkg_tag_read()
|
||||||
{
|
{
|
||||||
mpkg="$1"
|
mpkg="$1"
|
||||||
tag="$2"
|
tag="$2"
|
||||||
|
|
||||||
echo "$(curl -L 2>/dev/null "${MPM_REPO}/${mpkg}.mpm" | grep -e "${tag}: " | sed -e "s/^${tag}: //")"
|
if [[ "${MPM_REPO}" =~ ^https?:// ]]
|
||||||
|
then
|
||||||
|
echo "$(curl -L 2>/dev/null "${MPM_REPO}/${mpkg}.mpm" | grep -e "${tag}: " | sed -e "s/^${tag}: //")"
|
||||||
|
else
|
||||||
|
echo "$(cat 2>/dev/null "${MPM_REPO}/${mpkg}.mpm" | grep -e "${tag}: " | sed -e "s/^${tag}: //")"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
# MPM Meta Package Description
|
# MPM Meta Package Description
|
||||||
#-------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function mpm_mpkg_desc()
|
function mpm_mpkg_desc()
|
||||||
{
|
{
|
||||||
@@ -88,9 +199,11 @@ function mpm_mpkg_desc()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
# MPM Meta Package List
|
# MPM Meta Package List
|
||||||
#-------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function mpm_mpkg_pkglist()
|
function mpm_mpkg_pkglist()
|
||||||
{
|
{
|
||||||
@@ -101,29 +214,33 @@ function mpm_mpkg_pkglist()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
# MPM List
|
# MPM List
|
||||||
#-------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function mpm_list()
|
function mpm_list()
|
||||||
{
|
{
|
||||||
echo " MPM Name + MPM Description + Package List "
|
echo " MPM Name | MPM Description | Package List "
|
||||||
echo "--------------------+---------------------------------+------------------------------------------------"
|
echo "---------------------+----------------------------------+---------------------------------------------------------------------------"
|
||||||
|
|
||||||
mpm_mpkg_list | while read mpkg
|
mpm_mpkg_list | while read 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
|
# MPM Install
|
||||||
#-------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function mpm_install
|
function mpm_install
|
||||||
{
|
{
|
||||||
@@ -158,46 +275,42 @@ function mpm_install
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "installing MPM: [$mpkg]:[${pkglist}]"
|
echo "installing MPM: [$mpkg]:[${pkglist}]"
|
||||||
|
|
||||||
urpmi --force ${pkglist}
|
exec_cmd "urpmi --force ${pkglist}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
# MPM Main
|
# MPM Main
|
||||||
#-------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
case "${command}"
|
shopt -s extglob
|
||||||
|
|
||||||
|
mpm_args_parse "$@"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [[ ${mode} == "exit" ]]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "mode: [${mode}] verbose: [${verbose}] dry_run: [${dry_run}] Repo_URL: [${MPM_REPO}]" 1>&2
|
||||||
|
|
||||||
|
case "${mode}"
|
||||||
in
|
in
|
||||||
"--help" | "-h")
|
"list")
|
||||||
mpm_help
|
|
||||||
;;
|
|
||||||
|
|
||||||
"--list" | "-l")
|
|
||||||
mpm_list
|
mpm_list
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--install" | "-i")
|
"install")
|
||||||
mpm_install $arg
|
mpm_install "${mpm_name}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
|
||||||
if [[ "${command}" == "" ]]
|
|
||||||
then
|
|
||||||
echo "missing mandatory command!"
|
|
||||||
else
|
|
||||||
|
|
||||||
echo "unknown command [${command}]!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
mpm_help
|
|
||||||
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
|
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -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
var/www/mpm-repository/mariadb.mpm
Normal file
3
var/www/mpm-repository/mariadb.mpm
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#
|
||||||
|
PKG_DESC: MariaDB/MySQL Client
|
||||||
|
PKG_LIST: mariadb-client
|
||||||
3
var/www/mpm-repository/net_tools.mpm
Normal file
3
var/www/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
var/www/mpm-repository/postgres.mpm
Normal file
3
var/www/mpm-repository/postgres.mpm
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#
|
||||||
|
PKG_DESC: PostgreSQL Client
|
||||||
|
PKG_LIST: postgresql15
|
||||||
Reference in New Issue
Block a user