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))
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)
;;
esac
- sqlite3 $pkgfile <<EOS
+ zpm shell $pkgfile <<EOS
PRAGMA foreign_keys = ON;
begin;
insert or replace into packagefiles (package,version,release,path,mode,mtime,username,groupname,filetype,hash,target)