]> pd.if.org Git - zpackage/commitdiff
check for non-regular file in zpm test
authorNathan Wagner <nw@hydaspes.if.org>
Sat, 16 Sep 2017 21:14:56 +0000 (16:14 -0500)
committerNathan Wagner <nw@hydaspes.if.org>
Sat, 16 Sep 2017 21:14:56 +0000 (16:14 -0500)
This avoids creating an sqlite db automatically in the case the file
doesn't exist.

zpm-test

index da8ca6fb135ee67679a088c786d4da1ac08d857e..4ed9e85b2e2f2c9d8393c10dde79f0936339dfbe 100755 (executable)
--- a/zpm-test
+++ b/zpm-test
@@ -13,6 +13,13 @@ done
 shift $((OPTIND - 1))
 
 for pkgfile in "$@"; do
+       if [ ! -f "$pkgfile" ]; then
+               if [ "$verbose" -eq 1 ]; then
+                       echo $pkgfile does not appear to be a zpm package file 1>&2
+               fi
+               exit 1
+       fi
+
 appid=$(sqlite3 $pkgfile 'pragma application_id;' | ( echo obase = 16; cat - ) | bc)
 if [ "$appid" != "5A504442" ]; then
        if [ "$verbose" -eq 1 ]; then