From 40a2775ee3b08f365330b478ddceabc8b793f035 Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Thu, 30 Mar 2017 23:52:32 -0500 Subject: [PATCH] add missing shift optind --- zpm-addtopackage | 8 +++++--- zpm-newpackage | 13 ++++++++++--- zpm-test | 1 + 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/zpm-addtopackage b/zpm-addtopackage index cccd12d..1964b77 100755 --- a/zpm-addtopackage +++ b/zpm-addtopackage @@ -1,7 +1,5 @@ #!/bin/sh -package=${1:-$ZPMPACKAGE} -shift pkgver=${ZPMPKGVER:-1.0} pkgrel=${ZPMPKGREL:-1} @@ -24,6 +22,10 @@ while getopts :f:v:r:d:a:u:l:p:b:P: opt; do c) tags="$tags +configuration" ;; esac done +shift $((OPTIND - 1)) + +package="$1" +shift set -e if [ -z "$pkgfile" ]; then @@ -33,7 +35,7 @@ fi if [ ! -f $pkgfile ]; then zpm newpackage $package || exit 1 else - zpm-test -v $pkgfile + zpm test -v $pkgfile fi for path in $*; do diff --git a/zpm-newpackage b/zpm-newpackage index 2b94701..7ab8aa8 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,12 @@ 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)) + +package=$1 if [ -z "$pkgfile" ]; then pkgfile="$package-$pkgver-$pkgrel.zpm" @@ -30,8 +33,12 @@ if [ ! -e $pkgfile ]; then zpm init $pkgfile fi +if [ "$idempotent" = 1 ]; then + idempotent='or ignore' +fi + sqlite3 $pkgfile <