]> pd.if.org Git - zpackage/commitdiff
make zpm-pkg use zpm-init if needed
authorNathan Wagner <nw@hydaspes.if.org>
Wed, 28 Sep 2016 23:20:44 +0000 (23:20 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Wed, 28 Sep 2016 23:23:29 +0000 (23:23 +0000)
zpm-pkg

diff --git a/zpm-pkg b/zpm-pkg
index 28a652cd12d06128c9b4c8081801626eff3b5630..30630d3116149cc68af24df8d5a16a6b07f78d17 100755 (executable)
--- a/zpm-pkg
+++ b/zpm-pkg
@@ -1,8 +1,8 @@
 #!/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
@@ -20,22 +20,16 @@ done
 
 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)
 ;