3 pkgfile=${ZPM_PACKAGE_FILE:-${ZPMDB:-/var/lib/zpm/local.db}}
7 # newpackage -f pkgfile $pkgid
8 while getopts :f:vm:s:S: opt; do
10 f) pkgfile="$OPTARG" ;;
12 m) message="$OPTARG" ;;
13 s) status="$status -s $OPTARG" ;;
14 S) exclude="$exclude -S $OPTARG" ;;
17 shift $(( OPTIND - 1))
19 if [ -z "$message" ]; then
22 message=$(zpm quote -q "$message")
34 if [ ! -f "$pkgfile" ]; then
35 die $pkgfile does not exist
42 for pkgstr in "$@"; do
43 pkgid=$(zpm findpkg $status $exclude -f $pkgfile "$pkgstr")
44 if [ -z "$pkgid" ]; then
47 if [ $verbose -gt 0 ]; then
48 if [ $verbose -gt 1 ]; then
49 warn "found %s -> %s\n" "$pkgstr", "$pkgid"
52 pkgid=$(zpm quote "$pkgid")
53 printf "delete from packages_pkgid where pkgid = '$pkgid';\n"
54 printf "insert into zpmlog (action, target, info) values ('rmpackage','%s',%s);\n" "$pkgid" "$message"
57 } | zpm shell $pkgfile