--- /dev/null
+#!/bin/sh
+
+package=${1:-$ZPMPACKAGE}
+pkgver=${ZPMPACKAGEVER:-1.0}
+pkgrel=${ZPMPACKAGEREL:-1}
+
+while getopts :n:v:r:d:a:u:l:p:b: opt; do
+ case $opt in
+ n) pkgfile="$OPTARG" ;;
+ v) pkgver="$OPTARG" ;;
+ r) pkgrel="$OPTARG" ;;
+ d) description="$OPTARG" ;;
+ a) arch="$OPTARG" ;;
+ u) url="$OPTARG" ;;
+ l) licenses="$OPTARG" ;;
+ p) packager="$OPTARG" ;;
+ b) builddate="$OPTARG" ;;
+ esac
+done
+
+pkgfile="$package-$pkgver-$pkgrel.zpm"
+
+if [ ! -f $pkgfile ]; then
+ echo $pkgfile missing 1>&2
+ exit 1
+fi
+
+for path in $*; do
+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)
+;
+EOS
+done