X-Git-Url: https://pd.if.org/git/?p=zpackage;a=blobdiff_plain;f=bin%2Fzpm-test;fp=bin%2Fzpm-test;h=860a5d1de31a6335f3e014285d3b560ae4b53f60;hp=0000000000000000000000000000000000000000;hb=0419c62f964b259df1c1816f5870ef62eb97ed7c;hpb=0c2216d1e0dc8565a6bf61c9572e47bb1ae1c1fb diff --git a/bin/zpm-test b/bin/zpm-test new file mode 100755 index 0000000..860a5d1 --- /dev/null +++ b/bin/zpm-test @@ -0,0 +1,33 @@ +#!/bin/sh + +# tests a package file + +# just checks that all args are valid pkg files +verbose=0 + +while getopts v opt; do + case $opt in + v) verbose=1 ;; + esac +done +shift $((OPTIND - 1)) + +for pkgfile in "$@"; do + if [ ! -f "$pkgfile" ]; then + if [ "$verbose" -eq 1 ]; then + echo $pkgfile does not exist 1>&2 + fi + exit 1 + fi + +# 0x5A504442 == 1515209794 +appid=$(zpm shell $pkgfile 'pragma application_id;') +if [ "$appid" != "1515209794" ]; then + if [ "$verbose" -eq 1 ]; then + echo $pkgfile does not appear to be a zpm package file 1>&2 + fi + exit 1 +fi +done + +exit 0