X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-addtopackage;h=1b7bff4d3296d34e15cb08544709f98d7646569b;hb=dc08462c5c1d2cb9ae52a7b1df98603cb1160262;hp=a2e5aeec4c86c3a25c811b31b585d2c7010b4651;hpb=95c91056eb1fea49f96dcc2b1c5b91930e0b960a;p=zpackage diff --git a/zpm-addtopackage b/zpm-addtopackage index a2e5aee..1b7bff4 100755 --- a/zpm-addtopackage +++ b/zpm-addtopackage @@ -26,24 +26,25 @@ 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:Ccu:g: 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 ;; + u) username="$OPTARG" ;; + g) groupname="$OPTARG" ;; + *) echo 'unknown option' $opt; exit 1 ;; esac done shift $((OPTIND - 1)) @@ -59,18 +60,27 @@ 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) - username=$(zpm stat -f '%U' $path) - groupname=$(zpm stat -f '%G' $path) + : ${username:=$(zpm stat -f '%U' $path)} + : ${groupname:=$(zpm stat -f '%G' $path)} mode=$(zpm stat -f '%a' $path) rpath="$path" @@ -120,6 +130,7 @@ for path in $*; do ;; esac + # TODO check that we have such a package,version,release zpm shell $pkgfile <