X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;ds=sidebyside;f=zpm-newpackage;h=8cce97db78f323dbb7ead66849cee583d7808e6b;hb=6d070e7b1f4ae6e319c9a3a856d05d3de720c3bb;hp=2b947015c47e60d852aedd432edb2d480fbe6ff4;hpb=cd99bcfaa954c059bbae5fcaf89117fb493d91c7;p=zpackage diff --git a/zpm-newpackage b/zpm-newpackage index 2b94701..8cce97d 100755 --- a/zpm-newpackage +++ b/zpm-newpackage @@ -1,12 +1,11 @@ #!/bin/sh -package=${1:-$ZPMPACKAGE} pkgver=${ZPMPKGVER:-1.0} pkgrel=${ZPMPKGREL:-1} builddate=$(date '+%s') -while getopts :f:v:r:d:a:u:l:p:b: opt; do +while getopts :f:v:r:d:a:u:l:p:b:I opt; do case $opt in f) pkgfile="$OPTARG" ;; v) pkgver="$OPTARG" ;; @@ -17,8 +16,22 @@ while getopts :f:v:r:d:a:u:l:p:b: opt; do l) licenses="$OPTARG" ;; p) packager="$OPTARG" ;; b) builddate="$OPTARG" ;; + I) idempotent=1 esac done +shift $(( OPTIND - 1)) + +die() { + echo $* 1&>2 + exit 1 +} + +package=$1 +shift + +if [ -z "$package" ]; then + die "must specify package" +fi if [ -z "$pkgfile" ]; then pkgfile="$package-$pkgver-$pkgrel.zpm" @@ -30,8 +43,12 @@ if [ ! -e $pkgfile ]; then zpm init $pkgfile fi +if [ "$idempotent" = 1 ]; then + idempotent='or ignore' +fi + sqlite3 $pkgfile <