#!/bin/sh
package=${1:-$ZPMPACKAGE}
-pkgver=${ZPMPACKAGEVER:-1.0}
-pkgrel=${ZPMPACKAGEREL:-1}
+pkgver=${ZPMPKGVER:-1.0}
+pkgrel=${ZPMPKGREL:-1}
while getopts :n:v:r:d:a:u:l:p:b: opt; do
case $opt in
pkgfile="$package-$pkgver-$pkgrel.zpm"
+set -e
+
if [ ! -f $pkgfile ]; then
- echo $pkgfile missing 1>&2
- exit 1
+ zpm init $pkgfile
fi
for path in $*; do
-hash=$(./zpm-addfile $pkgfile $path)
+ hash=$(./zpm-addfile $pkgfile $path)
sqlite3 $pkgfile <<EOS
-create table if not exists packagefiles (
- package text,
- subpackage text, -- libs, dev, client, server, whatever
- hash text,
- path text,
- filetype text -- e.g. config, etc?
-);
insert into packagefiles
values ('$package', nullif('$subpackage', ''), '$hash', '$path', NULL)
;