From bd022b90874dda4a9873726691960fcd05a8bf63 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Sun, 17 Aug 2008 21:10:45 +0000 Subject: [PATCH] sde-package: Added package_exists() to lib/sde-package.in --- lib/sde-package.in | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/sde-package.in b/lib/sde-package.in index 26bb882..2f9e4bd 100644 --- a/lib/sde-package.in +++ b/lib/sde-package.in @@ -12,14 +12,24 @@ # GNU General Public License can be found in the file COPYING. # --- SDE-COPYRIGHT-NOTE-END --- -package_autodetect() { +package_autodetect() +{ pwd -P | sed -n -e "s,^$SDEROOT/package/[^/]*/\([^/]*\)\(/.*\)\?$,\1,p" } -package_autodetect_repo() { +package_autodetect_repo() +{ pwd -P | sed -n -e "s,^$SDEROOT/package/\([^/]*\)\(/.*\)\?,\1,p" } -package_confdir() { +package_exists() +{ + local x=$( ls -1 "$SDEROOT/package"/*/"$1/$1.desc" 2> /dev/null ) + + [ -s "$x" ] +} + +package_confdir() +{ ls -1d "$SDEROOT/package"/*/"$1" 2> /dev/null | head -n 1 }