From: Nathan Wagner Date: Sat, 11 Aug 2018 02:40:31 +0000 (+0000) Subject: add zpm-contents script X-Git-Tag: v0.1.6~68 X-Git-Url: https://pd.if.org/git/?p=zpackage;a=commitdiff_plain;h=be0c6a3ddf95ba9694763324509e58eb48199ae6 add zpm-contents script --- diff --git a/Makefile b/Makefile index b419428..96aca9d 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CFLAGS=-Wall -W -Wextra -Werror -Wno-implicit-fallthrough -std=c99 -Ilib -Isqlit ZPMVER:=$(shell git tag --list 'v[0-9]*' | sed -e 's/^v//' | sort -nr | head -1) ifeq ($(strip $(ZPMVER)),) - ZPMVER:=0.1.1 + ZPMVER:=0.1.2 endif LZMAFLAGS=-Ilzma/api -Ilzma/tuklib -Ilzma/lzma -Ilzma/common -Ilzma/check -Ilzma/lz -Ilzma/rangecoder -Ilzma/simple -Ilzma/delta -DHAVE_CHECK_CRC64 -DHAVE_CHECK_CRC32 -DHAVE_ENCODER_LZMA2 -DHAVE_DECODER_LZMA2 -DHAVE_MF_BT4 @@ -18,7 +18,8 @@ curdir=$(shell pwd) ZPKGBIN=zpm-addfile zpm-extract zpm-init zpm-vercmp zpm-stat zpm-hash \ zpm-findpkg zpm-shell zpm-soneed -SCRIPTS=zpm zpm-install zpm-merge zpm-list zpm-preserve zpm-test zpm-log +SCRIPTS=zpm zpm-install zpm-merge zpm-list zpm-preserve zpm-test zpm-log \ + zpm-contents COMPILED=$(ZPKGBIN) PROGRAMS=$(SCRIPTS) $(COMPILED) @@ -130,7 +131,10 @@ clean: *.xz *.zpm \ local.db t/ctap/prove.o -tmpinstall: package +tmpinstall: rm -rf tmp mkdir tmp + ZPMDB=tmp/db.zpm ./zpm -P. install -R tmp -f zpm-0.1.1-1.zpm -u nw -g nw + +tmpupgrade: ZPMDB=tmp/db.zpm ./zpm -P. install -R tmp -f zpm-$(ZPMVER)-1.zpm -u nw -g nw diff --git a/zpm-contents b/zpm-contents new file mode 100755 index 0000000..0d1a027 --- /dev/null +++ b/zpm-contents @@ -0,0 +1,32 @@ +#!/bin/sh + +pkgfile=${ZPMDB:-/var/lib/zpm/db.zpm} + +while getopts f: opt; do + case $opt in + f) pkgfile="$OPTARG" ;; + esac +done +shift $((OPTIND - 1)) + +set -e + +if [ ! -f $pkgfile ]; then + echo cannot find $pkgfile + exit 1 +fi + + +for pkg in "$@"; do + pkgid=$(zpm findpkg $pkgfile $pkg) + + zpm shell $pkgfile <