Re: How to package up (all) installed ports

From: Alejandro Pulver (alejandro_at_varnet.biz)
Date: 02/18/05

  • Next message: Danny Pansters: "Re: How to package up (all) installed ports"
    Date: Thu, 17 Feb 2005 22:17:26 -0300
    To: danny@ricin.com
    
    

    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
    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"


  • Next message: Danny Pansters: "Re: How to package up (all) installed ports"

    Relevant Pages

    • Re: portupgrade O(n^m)?
      ... wanted to try and port sections of portupgrade and its related tools to ... in 15 mn to 20 mn you have your packages. ... because packages don't break when compiling. ... pkg_add for around 500 ports replaced. ...
      (freebsd-hackers)
    • Re: portupgrade O(n^m)?
      ... in 15 mn to 20 mn you have your packages. ... >> because packages don't break when compiling. ... >> packages for installation are already present on the machine. ... >> modifying the origins of the ports. ...
      (freebsd-hackers)
    • Re: [HOW-TO] cvsup for ports -- Re: compact portsnap db
      ... It is better to use all ports or all packages so either do: ... people install php at all. ... And yes there are some ports that don't have packages for licencing ... Preferring cvsup to portsnap is kinda like preferring vim ...
      (freebsd-questions)
    • Re: [HOW-TO] cvsup for ports -- Re: compact portsnap db
      ... The only problems I've ever seen with installing packages is that at ... And yes there are some ports that don't have packages for licencing etc ... though I can't recall ever having to install one of those. ... >> Preferring cvsup to portsnap is kinda like preferring vim over ...
      (freebsd-questions)
    • Re: newbie package/ports questions
      ... I have an updated ports tree using portsnap (fetched and extracted ... everything compile from ports and it seems to work fine, but packages ... would of course be faster to install. ... portupgrade -NPRr kde ...
      (comp.unix.bsd.freebsd.misc)