Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Feb 2005 22:17:26 -0300
From:      Alejandro Pulver <alejandro@varnet.biz>
To:        danny@ricin.com
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How to package up (all) installed ports
Message-ID:  <20050217221726.6d6dff54@ale.varnet.bsd>
In-Reply-To: <200502180009.47816.danny@ricin.com>
References:  <200502180009.47816.danny@ricin.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 18 Feb 2005 00:09:47 +0100
Danny Pansters <danny@ricin.com> wrote:

> What would be a good way to create binary packages of all/most of my currently 
> installed ports (without rebuilding as "make package" does)? 
> 
> I want to move my entire setup to another disk (array) and like to get rid of 
> any acumulated junk in the process so best would be to get packages from my 
> current system, make world and kernel on the new disk (array) and then 
> install the packages or vice versa. Would save a few days of compiling.
> 
> Thanks,
> 
> Dan

Hello,

The command to create packages of the ports installed in the system is pkg_create(1), it is used with the "-b" option (in this case), like this:

pkg_create -b <installed-port-name>

The name of the installed port is as outputed by pkg_info(1).

The default format is .tar.gz (.tgz), but the "-j" option allows to use bzip2.

I made a (simple) shell script to create packages of all the ports installed in the system.

----------BEGIN----------
#!/bin/sh

# Shell script to create packages of all the ports installed in the system.
# Usage: 'sh package-ports.sh'
# Will create the packages in the current directory.

PORTS=`pkg_info | awk '{print $1}'`	# Filter the description.
NUM_PORTS=`echo "$PORTS" | awk 'END {print NR}'`
BZIP="-j"				# Use bzip2 instead of gzip.
PKGCMD="pkg_create $BZIP -b"		# Command to create package.

echo "Packaging $NUM_PORTS ports"

# Process one port at time.

for PORT in $PORTS
do
	echo "Packaging port \"$PORT\""
	$PKGCMD $PORT
done

echo "Done"

exit 0
----------END------------

To use it create a directory to store the packages (like 'mkdir packages'),
save the script there and run it with 'sh <script>', or './script' (in the last case the file must be executable).

Best Regards,
Ale



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050217221726.6d6dff54>