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.

2. Load it into shell variable (for /bin/sh)
LIST=$(cat ~/work.list)

3. 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;

4. Run over list
for pkg in ${LIST} ; do
        # Check if we have such package
        if [ ! -f "/usr/ports/packages/Latest/${NAME}.txz" ]; then
                create "${pkg}";

5. 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

Поиск по этому блогу