How to package up (all) installed ports
Alejandro Pulver
alejandro at varnet.biz
Fri Feb 18 01:16:56 GMT 2005
On Fri, 18 Feb 2005 00:09:47 +0100
Danny Pansters <danny at 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
More information about the freebsd-questions
mailing list