diff options
Diffstat (limited to 'pkgtools/pkgconflict/files/pkgdbextract')
-rwxr-xr-x | pkgtools/pkgconflict/files/pkgdbextract | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/pkgtools/pkgconflict/files/pkgdbextract b/pkgtools/pkgconflict/files/pkgdbextract new file mode 100755 index 00000000000..fcd81f88df8 --- /dev/null +++ b/pkgtools/pkgconflict/files/pkgdbextract @@ -0,0 +1,40 @@ +#!/bin/csh -f +# $NetBSD: pkgdbextract,v 1.1 2001/04/03 18:03:04 wennmach Exp $ +# +# pkgdbextract: tool to extract packages databases from binary packages +# into a destination directory, suitable for use with pkgconflict +# +# Author: Lex Wennmacher <wennmach@netbsd.org> +# + +# Usage pkgdbextract BASEDIR package1.tgz [ package2.tgz ... ] + +set nargs=$#argv +if ($nargs < 2) then + echo pkgdbextract: usage: pkgdbextract BASEDIR package1.tgz [ package2.tgz ... ] + exit -1 +endif + +set BASEDIR=$1 + +if (! -d $BASEDIR) mkdir -p $BASEDIR +if (! -d $BASEDIR) then + echo could not create $BASEDIR + exit -1 +endif + +# Loop over all packages (args 2 - ) +foreach pkg (`echo $argv[2-]`) + if (-e $pkg) then + set pkgbinname=$pkg:t + set pkgname=$pkgbinname:r + set DESTDIR=$BASEDIR/$pkgname + mkdir -p $DESTDIR + tar --fast-read -xzf $pkg +CONTENTS -C $DESTDIR + else +# It is not an error if a package can not be read + echo "pkgdbextract: warning: $pkg not readable" + endif +end + +exit 0 |