aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2015-11-28 02:19:56 -0500
committerTim Harder <radhermit@gmail.com>2015-11-28 02:19:56 -0500
commit8ce2b9ab0596d9f309567ce98b4eed2459203655 (patch)
tree160fe0de8d66011691198058e414bc74c8d97329
parentshell/pkgcore.sh: various changes to fix usage with bash (diff)
downloadpkgcore-8ce2b9ab0596d9f309567ce98b4eed2459203655.tar.gz
pkgcore-8ce2b9ab0596d9f309567ce98b4eed2459203655.tar.bz2
pkgcore-8ce2b9ab0596d9f309567ce98b4eed2459203655.zip
shell/pkgcore.sh: clean up checking for bad package atoms
-rw-r--r--shell/pkgcore.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/shell/pkgcore.sh b/shell/pkgcore.sh
index e388fa62a..919a2a0af 100644
--- a/shell/pkgcore.sh
+++ b/shell/pkgcore.sh
@@ -5,21 +5,23 @@
# basically required.
_ebuild_path() {
- if [[ -z $1 || ${1:0:1} == "-" ]]; then
+ if [[ -z $1 ]]; then
echo "Enter a valid package name." >&2
return 1
fi
- repo=$2
local -a pkg
- local p
+ local p repo=$2
if [[ -n ${repo} ]]; then
- pkg=( $(pquery -r "${repo}" --raw "$1" --cpv --one-attr path -n) )
+ pkg=( $(pquery -r "${repo}" --raw --cpv --one-attr path -n -- "$1" 2>/dev/null) )
else
- pkg=( $(pquery --ebuild-repos --raw "$1" --cpv --one-attr path -n) )
+ pkg=( $(pquery --ebuild-repos --raw --cpv --one-attr path -n -- "$1" 2>/dev/null) )
+ fi
+ if [[ $? != 0 ]]; then
+ echo "Invalid package atom: '$1'" >&2
+ return 1
fi
- [[ $? != 0 ]] && return 1
if [[ -z ${pkg[@]} ]]; then
echo "No matches found." >&2