summaryrefslogtreecommitdiffstats
path: root/db-functions
diff options
context:
space:
mode:
authorAaron Griffin <aaronmgriffin@gmail.com>2008-09-14 00:49:59 +0200
committerAaron Griffin <aaronmgriffin@gmail.com>2008-09-14 00:49:59 +0200
commita0f73ceca409fa8995af16eee8440c1467c5f1bf (patch)
treec08c74f9b2f9d6a3d44e34672246565c8179ed34 /db-functions
parent0730a707da94ff30b94c1f7829c8d247ddf0eeb2 (diff)
downloaddbscripts-a0f73ceca409fa8995af16eee8440c1467c5f1bf.tar.gz
dbscripts-a0f73ceca409fa8995af16eee8440c1467c5f1bf.tar.xz
Validate a package file's architecture
Apparently, people seem to be renaming files as a "hack" and breaking things. Let's make sure they edited the PKGINFO too Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'db-functions')
-rw-r--r--db-functions17
1 files changed, 17 insertions, 0 deletions
diff --git a/db-functions b/db-functions
index 25bca78..663067e 100644
--- a/db-functions
+++ b/db-functions
@@ -46,4 +46,21 @@ getpkgname() {
echo ${tmp%-*-*}
}
+check_pkg_arch () { #check_pkg_arch pkgfile arch
+ local arch
+ _arch="$(/usr/bin/bsdtar -xOf "$1" .PKGINFO | /bin/grep "^arch" | /bin/sed 's|\w*\s*=\s*\(.*\)|\1|')"
+
+ if [ -z "$_arch" ]; then
+ echo "ERROR: Package '$1' has no arch in the PKGINFO. Fail!"
+ return 1
+ fi
+ if [ "$_arch" = "$2" ]; then
+ echo "yay"
+ return 0
+ else
+ echo "nay"
+ return 1
+ fi
+}
+
# vim: set ts=4 sw=4 noet ft=sh: