aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2009-08-30 22:16:15 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2009-08-30 22:16:15 +0000
commit83dd37ec007c0244b23241be4c6a134f8b993c28 (patch)
tree19d3290d5f6c2494ecc3062d912841c43e093a3e
parent632ec0d8518f1ee1b2af1eeae6a9d967dd26b16f (diff)
downloadsimplepkg-83dd37ec007c0244b23241be4c6a134f8b993c28.tar.gz
simplepkg-83dd37ec007c0244b23241be4c6a134f8b993c28.tar.bz2
Cleanup and bugfix for #94 and #95
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@812 04377dda-e619-0410-9926-eae83683ac58
-rw-r--r--trunk/lib/common.sh45
-rwxr-xr-xtrunk/src/simplaret2
2 files changed, 16 insertions, 31 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh
index 2453099..f05b276 100644
--- a/trunk/lib/common.sh
+++ b/trunk/lib/common.sh
@@ -32,7 +32,17 @@ SIMPLARET="simplaret"
function pkg_ext {
# list all possible package extensions
- echo .tgz .tbz .tlz .txz
+ local ext exts
+
+ for ext in tgz tbz tlz txz; do
+ if [ ! -z "$1" ]; then
+ exts="$exts $1.$ext"
+ else
+ exts="$exts $ext"
+ fi
+ done
+
+ echo $exts
}
@@ -41,16 +51,7 @@ function pkg_ext_grep {
# list all possible package extensions
# grep extended regexp version
- local period
-
- if [ "$1" == "." ]; then
- $period="."
- fi
-
- for ext in `pkg_ext`; do
- exts="$exts|$period$ext"
- done
- echo $exts
+ echo "($(pkg_ext $1))" | sed -e 's/ /|/g'
}
@@ -59,18 +60,7 @@ function pkg_ext_sed {
# list all possible package extensions
# sed regexp version
- local period
-
- if [ "$1" == "." ]; then
- $period="."
- fi
-
- exts="\("
- for ext in `pkg_ext`; do
- exts="$exts\|$period$ext"
- done
- exts="\)"
- echo $exts
+ echo "($(pkg_ext $1))" | sed -e 's/ /\\|/g'
}
@@ -87,12 +77,7 @@ function pkg_ext_find {
match="*"
fi
- exts="("
- for ext in `pkg_ext`; do
- exts="$exts -or -name $match.$ext"
- done
- exts=")"
- echo $exts
+ echo "($(pkg_ext $match))" | sed -e 's/ / -or -name /g'
}
@@ -101,7 +86,7 @@ function strip_basename {
file="$1"
shift
for ext in $*; do
- file="`basename $file $ext`"
+ file="`basename $file .$ext`"
done
echo $file
diff --git a/trunk/src/simplaret b/trunk/src/simplaret
index b981867..27827c6 100755
--- a/trunk/src/simplaret
+++ b/trunk/src/simplaret
@@ -241,7 +241,7 @@ function simplaret_repository_url {
if [ "$repos_type" == "root" ]; then
simplaret_set_arch
distro="`basename $repository_url`"
- if [ "$ARCH" == "x86_64" && "$distro" == "slackware" ]; then
+ if [ "$ARCH" == "x86_64" ] && [ "$distro" == "slackware" ]; then
distro="slackware64"
fi
repository_url="$repository_url/$distro-$VERSION/"