]> pd.if.org Git - zpackage/blob - zpm-pkg
large commit of C work
[zpackage] / zpm-pkg
1 #!/bin/sh
2
3 package=${1:-$ZPMPACKAGE}
4 pkgver=${ZPMPACKAGEVER:-1.0}
5 pkgrel=${ZPMPACKAGEREL:-1}
6
7 while getopts :n:v:r:d:a:u:l:p:b: opt; do
8         case $opt in
9                 n) pkgfile="$OPTARG" ;;
10                 v) pkgver="$OPTARG" ;;
11                 r) pkgrel="$OPTARG" ;;
12                 d) description="$OPTARG" ;;
13                 a) arch="$OPTARG" ;;
14                 u) url="$OPTARG" ;;
15                 l) licenses="$OPTARG" ;;
16                 p) packager="$OPTARG" ;;
17                 b) builddate="$OPTARG" ;;
18         esac
19 done
20
21 pkgfile="$package-$pkgver-$pkgrel.zpm"
22
23 if [ ! -f $pkgfile ]; then
24         echo $pkgfile missing 1>&2
25         exit 1
26 fi
27
28 for path in $*; do
29 hash=$(./zpm-addfile $pkgfile $path)
30
31 sqlite3 $pkgfile <<EOS
32 create table if not exists packagefiles (
33         package text,
34         subpackage      text, -- libs, dev, client, server, whatever
35         hash    text,
36         path    text,
37         filetype        text -- e.g. config, etc?
38 );
39 insert into packagefiles
40 values ('$package', nullif('$subpackage', ''), '$hash', '$path', NULL)
41 ;
42 EOS
43 done