]> pd.if.org Git - zpackage/blobdiff - zpm-pkg
large commit of C work
[zpackage] / zpm-pkg
diff --git a/zpm-pkg b/zpm-pkg
new file mode 100755 (executable)
index 0000000..28a652c
--- /dev/null
+++ b/zpm-pkg
@@ -0,0 +1,43 @@
+#!/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