aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Schmaus <flow@gentoo.org>2023-03-14 15:23:07 +0100
committerUlrich Müller <ulm@gentoo.org>2023-03-14 17:54:40 +0100
commitc7e76fc0b9add97eda8cf406cbd168a1997e9ae3 (patch)
tree1865b0bfbcdc4344b71f61b8b445d263a43ea5fe
parentSupport NO_COLOR (diff)
downloadeselect-c7e76fc0b9add97eda8cf406cbd168a1997e9ae3.tar.gz
eselect-c7e76fc0b9add97eda8cf406cbd168a1997e9ae3.tar.bz2
eselect-c7e76fc0b9add97eda8cf406cbd168a1997e9ae3.zip
Allow to specify modules by path
* libs/core.bash.in (find_module): Allow to specify an absolute path as the module's filename. Bug: https://bugs.gentoo.org/901205 Signed-off-by: Florian Schmaus <flow@gentoo.org> Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r--ChangeLog5
-rw-r--r--libs/core.bash.in11
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index aab936d..57a53fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-03-14 Florian Schmaus <flow@gentoo.org>
+
+ * libs/core.bash.in (find_module): Allow to specify an absolute
+ path as the module's filename.
+
2023-02-28 Ulrich Müller <ulm@gentoo.org>
* bin/eselect.in: Disable colours if NO_COLOR is nonempty.
diff --git a/libs/core.bash.in b/libs/core.bash.in
index 740354e..2800cc5 100644
--- a/libs/core.bash.in
+++ b/libs/core.bash.in
@@ -1,5 +1,5 @@
# -*-eselect-*- vim: ft=eselect
-# Copyright (c) 2005-2020 Gentoo Authors
+# Copyright (c) 2005-2023 Gentoo Authors
#
# This file is part of the 'eselect' tools framework.
#
@@ -69,6 +69,15 @@ die() {
# Find module and echo its filename. Die if module doesn't exist.
find_module() {
local modname=$1 modpath
+
+ if [[ ${modname} == */* ]]; then
+ if [[ ${modname} == *.eselect && -f ${modname} ]]; then
+ echo "${modname}"
+ return
+ fi
+ die -q "Can't load module ${modname}"
+ fi
+
for modpath in "${ESELECT_MODULES_PATH[@]}"; do
if [[ -f ${modpath}/${modname}.eselect ]]; then
echo "${modpath}/${modname}.eselect"