From owner-freebsd-questions@FreeBSD.ORG Fri Feb 18 01:16:56 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 04FCD16A4CE for ; Fri, 18 Feb 2005 01:16:56 +0000 (GMT) Received: from relay.pair.com (relay00.pair.com [209.68.1.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 64DF543D45 for ; Fri, 18 Feb 2005 01:16:55 +0000 (GMT) (envelope-from alejandro@varnet.biz) Received: (qmail 22664 invoked from network); 18 Feb 2005 01:16:54 -0000 Received: from unknown (HELO ale.varnet.bsd) (unknown) by unknown with SMTP; 18 Feb 2005 01:16:54 -0000 X-pair-Authenticated: 200.115.214.206 Date: Thu, 17 Feb 2005 22:17:26 -0300 From: Alejandro Pulver To: danny@ricin.com Message-ID: <20050217221726.6d6dff54@ale.varnet.bsd> In-Reply-To: <200502180009.47816.danny@ricin.com> References: <200502180009.47816.danny@ricin.com> X-Mailer: Sylpheed-Claws 0.9.12b (GTK+ 1.2.10; i386-portbld-freebsd5.3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: freebsd-questions@freebsd.org Subject: Re: How to package up (all) installed ports X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Feb 2005 01:16:56 -0000 On Fri, 18 Feb 2005 00:09:47 +0100 Danny Pansters 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 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