summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-09-12 19:20:01 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-09-12 19:20:01 +0200
commit2c6b7c3ebefa33e865d2293331dcf166cb580bd9 (patch)
tree681535e236041104326371a6599acf54930d3a57
parente67a4695ee9550dfa7de153c48d3949891acb048 (diff)
downloaddbscripts-2c6b7c3ebefa33e865d2293331dcf166cb580bd9.tar.gz
dbscripts-2c6b7c3ebefa33e865d2293331dcf166cb580bd9.tar.xz
_grep_pkginfo: use a more specific format
-rw-r--r--db-functions12
1 files changed, 6 insertions, 6 deletions
diff --git a/db-functions b/db-functions
index cf13531..03859fb 100644
--- a/db-functions
+++ b/db-functions
@@ -183,8 +183,8 @@ repo_unlock () { #repo_unlock <repo-name> <arch>
_grep_pkginfo() {
local _ret
- _ret="$(/usr/bin/bsdtar -xOqf "$1" .PKGINFO | /bin/grep -m 1 -E "$2" | /bin/sed 's|\w*\s*=\s*\(.*\)|\1|')"
- echo "$_ret"
+ _ret="$(/usr/bin/bsdtar -xOqf "$1" .PKGINFO | /bin/grep -m 1 "^${2} = ")"
+ echo "${_ret#${2} = }"
}
@@ -192,7 +192,7 @@ _grep_pkginfo() {
getpkgbase() {
local _base
- _base="$(_grep_pkginfo "$1" "^pkgbase")"
+ _base="$(_grep_pkginfo "$1" "pkgbase")"
if [ -z "$_base" ]; then
getpkgname "$1"
fi
@@ -204,7 +204,7 @@ getpkgbase() {
getpkgname() {
local _name
- _name="$(_grep_pkginfo "$1" "^pkgname")"
+ _name="$(_grep_pkginfo "$1" "pkgname")"
if [ -z "$_name" ]; then
error "Package '$1' has no pkgname in the PKGINFO. Fail!"
exit 1
@@ -217,7 +217,7 @@ getpkgname() {
getpkgver() {
local _ver
- _ver="$(_grep_pkginfo "$1" "^pkgver")"
+ _ver="$(_grep_pkginfo "$1" "pkgver")"
if [ -z "$_ver" ]; then
error "Package '$1' has no pkgver in the PKGINFO. Fail!"
exit 1
@@ -229,7 +229,7 @@ getpkgver() {
getpkgarch() {
local _ver
- _ver="$(_grep_pkginfo "$1" "^arch")"
+ _ver="$(_grep_pkginfo "$1" "arch")"
if [ -z "$_ver" ]; then
error "Package '$1' has no arch in the PKGINFO. Fail!"
exit 1