builddate=$(date '+%s')
-while getopts :f:v:r:d:a:u:l:p:b:I opt; do
+# create a new package in: local, env, arg
+# arg, then env, then local
+
+# the repo given via ZPMDB
+# the repo implied by the arguments
+# the repo in /var/lib/zpm/local.db
+
+while getopts :f:v:r:d:a:u:l:p:b:In: opt; do
case $opt in
f) pkgfile="$OPTARG" ;;
+ n) pkgname="$OPTARG" ;;
v) pkgver="$OPTARG" ;;
r) pkgrel="$OPTARG" ;;
d) description="$OPTARG" ;;
I) idempotent=1
esac
done
-shift $(( $OPTIND - 1))
+shift $(( OPTIND - 1))
+
+die() {
+ echo $* 1>&2
+ exit 1
+}
package=$1
+shift
+
+if [ -z "$package" ]; then
+ die "must specify package"
+fi
if [ -z "$pkgfile" ]; then
pkgfile="$package-$pkgver-$pkgrel.zpm"
idempotent='or ignore'
fi
-sqlite3 $pkgfile <<EOS
+zpm shell $pkgfile <<EOS
insert $idempotent into packages ("package", "version", "release", "build_time")
values ('$package', '$pkgver', $pkgrel, $builddate)
;