]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
Cleanup and bugfix for #94 and #95
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sun, 30 Aug 2009 22:16:15 +0000 (22:16 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sun, 30 Aug 2009 22:16:15 +0000 (22:16 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@812 04377dda-e619-0410-9926-eae83683ac58

trunk/lib/common.sh
trunk/src/simplaret

index 24530990ebf21c97588b57bd6fbbf6cdee6ae2e7..f05b2760cf0e4c2648b075285140915bdc5e0cc4 100644 (file)
@@ -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
 
index b981867163ae16dfd8b64df2e8efb21d27211fe5..27827c68b3c82696d4b2df79f414ac6867383e5b 100755 (executable)
@@ -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/"