Subject: Re: Question about "make package"
To: Urban Boquist <>
From: Jim Bernard <>
List: tech-pkg
Date: 07/07/1998 06:56:36
On 7 7, Urban Boquist wrote:
> /usr/sbin/pkg_create -v -c /usr/src/pkg/shells/bash2/pkg/COMMENT
> 	-d /usr/src/pkg/shells/bash2/pkg/DESCR
> 	-f /usr/src/pkg/shells/bash2/work/.PLIST
> 	-p /usr/pkg -P "" gtexinfo-3.12 -m /etc/mtree/BSD.pkg.dist
> 	/usr/src/pkg/shells/bash2/../../packages/All/bash-2.02.tgz
> If I instead give /var/db/pkg/bash-2.02/+CONTENTS to the "-f" flag and
> run the command manually, *exactly* the same binary package is built,
> with one minor exception. In the latter case, the resulting +CONTENTS
> contains duplicated "@comment MD5..." lines. But that seems easy to fix...
> Hubert> (The pkg-upgrading-issue would need to be dealt with there, too...)
> Yes, I realise that there might be some cases where my method will
> break, but I'd like to understand why. For me it would make life much
> easier if +CONTENTS could be used to build packages instead.

  Here's a little script (I call it "mkpkg") that I use to build package
files from already-installed packages.  I find it useful mainly for backing
up a package before deleting it in preparation for installing an updated

#! /bin/sh
# Construct a binary package entirely from an installed package

pkg_info -e $pkg_name || { echo "$pkg_name is not installed" && exit 1; }
PREFIX=$(pkg_info -q -p $pkg_name | sed -e 's/^@cwd //')

ARGS="-v -p ${PREFIX}"

if [ -f ${file} ]; then ARGS="${ARGS} -c ${file}"; fi

if [ -f ${file} ]; then ARGS="${ARGS} -d ${file}"; fi

if [ -f ${file} ]; then ARGS="${ARGS} -f ${file}"; fi

if [ -f ${file} ]; then ARGS="${ARGS} -i ${file}"; fi

if [ -f ${file} ]; then ARGS="${ARGS} -k ${file}"; fi

if [ -f ${file} ]; then ARGS="${ARGS} -D ${file}"; fi

if [ -f ${file} ]; then ARGS="${ARGS} -m ${file}"; fi

pkg_create ${ARGS} ./$pkg_name.tgz