3 pkgfile=${ZPM_PACKAGE_FILE:-${ZPMDB:-/var/lib/zpm/local.db}}
7 # newpackage -f pkgfile $pkgid
8 while getopts :f:vm: opt; do
10 f) pkgfile="$OPTARG" ;;
12 m) message="$OPTARG" ;;
15 shift $(( OPTIND - 1))
17 if [ -z "$message" ]; then
20 message=$(zpm quote -q "$message")
32 if [ ! -f "$pkgfile" ]; then
33 die $pkgfile does not exist
39 for pkgstr in "$@"; do
40 pkgid=$(zpm findpkg -f $pkgfile "$pkgstr")
41 if [ $verbose -gt 0 ]; then
42 if [ -z "$pkgid" ]; then
43 warn "$pkgstr not found"
46 if [ $verbose -gt 1 ]; then
47 warn "found %s -> %s\n" "$pkgstr", "$pkgid"
50 pkgid=$(zpm quote "$pkgid")
51 printf "delete from packages_pkgid where pkgid = '$pkgid';\n"
52 printf "insert into zpmlog (action, target, info) values ('rmpackage','%s',%s);\n" "$pkgid" "$message"
55 } | zpm shell $pkgfile