pkgng-ing everything you done some time ago

Just to not forget :) If you playing with new platform, build many ports and leave it not cleaned, some time later you may find it interesting to share that with other good guys or just to setup same on a different machine.

So how to done that:

  1. Find what you build before:
find /usr/ports -name work | sed 's#/usr/ports/##; s#/work##' > ~/work.list

you will get list in format category/name.

  1. Load it into shell variable (for /bin/sh)
LIST=$(cat ~/work.list)
  1. create shell function (of course you can done it in one command, but it is unreadable)
create ()
{
        pkg=$1; # Only one arg - category/name
        echo "Make package ${pkg}";
        # cd to port dir
        cd "/usr/ports/${pkg}";
        # Remove install and package markers
        rm work/.install* work/.package*;
        # call make to do install and package (it will do build if it not done also)
        make FORCE_PKG_REGISTER=yes package;
}
  1. Run over list
for pkg in ${LIST} ; do
        NAME=${pkg##*/};
        # Check if we have such package
        if [ ! -f "/usr/ports/packages/Latest/${NAME}.txz" ]; then
                create "${pkg}";
        fi;
done
  1. Time to drink something (coffee, beer, vodka, etc.)

P.S. If you have not broken pkgng database, you may try to just run:

pkg create -a

:)

Good luck with pkgng-ing

Oleksandr Rybalko a.k.a. Ray
Oleksandr Rybalko a.k.a. Ray
SRE/DevOps/Engineer SW/HW

The man who love HW and SW. And know!