X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-addtopackage;h=81c1bcb5b1cbc9fe7f8417de6bd4e54cd238b672;hb=cd4fd08b5433d74d8ac33922a2f6cbf2f5a0c99f;hp=a2e5aeec4c86c3a25c811b31b585d2c7010b4651;hpb=4fa632b030f4e95473bf9738e05d9e9725e2cd8b;p=zpackage diff --git a/zpm-addtopackage b/zpm-addtopackage index a2e5aee..81c1bcb 100755 --- a/zpm-addtopackage +++ b/zpm-addtopackage @@ -26,24 +26,23 @@ cleanpath() { printf "%s" "$clean" } +tags= +create=0 # option for "multipackage" just to let the system know that's what you meant # option to take filenames from stdin # parse package, version, release from file if not given -while getopts :f:v:r:d:a:u:l:p:b:P:S: opt; do +while getopts :f:v:r:l:P:S:Cc opt; do case $opt in f) 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" ;; P) prefix="$OPTARG" ;; S) strip=$(cleanpath "$OPTARG"); ;; - t) tags="$OPTARG" ;; - c) tags="$tags +configuration" ;; + t) tags="$tags $OPTARG" ;; + c) tags="$tags configuration" ;; + C) create=1 ;; + *) echo 'unknown option'; exit 1 ;; esac done shift $((OPTIND - 1)) @@ -59,13 +58,22 @@ if [ -z "$pkgfile" ]; then pkgfile="$package-$pkgver-$pkgrel.zpm" fi -# make sure package exists -zpm newpackage -I -f $pkgfile -v $pkgver -r $pkgrel $package || exit 1 +# check for package file +if [ ! -f "$pkgfile" ]; then + if [ $create -eq 1 ]; then + echo creating $pkgfile + zpm newpackage -I -f $pkgfile -v $pkgver -r $pkgrel $package || exit 1 + else + echo $pkgfile does not exist + exit 1 + fi +fi zpm test -v $pkgfile #strip=$(cleanpath "$strip") for path in $*; do + echo adding $path mtime=$(zpm stat -f '%y' $path) uid=$(zpm stat -f '%u' $path) gid=$(zpm stat -f '%g' $path)