Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Oct 2016 13:50:48 -0700 (PDT)
From:      Roger Marquis <marquis@roble.com>
To:        Julian Elischer <julian@freebsd.org>
Cc:        "ports@FreeBSD.org" <ports@freebsd.org>,  Baptiste Daroussin <bapt@FreeBSD.org>
Subject:   Re: harder and harder to avoid pkg
In-Reply-To: <638fe078-80db-2492-90be-f1280eb8d445@freebsd.org>
References:  <638fe078-80db-2492-90be-f1280eb8d445@freebsd.org>

| previous in thread | raw e-mail | index | archive | help
On Tue, 11 Oct 2016, Julian Elischer wrote:
> *manually* (scripted) copy out only the files I need, and then copy the pkg 
> database, so that when run on the running appliance, pkg THINKS all the 
> packages are loaded

We do something similar using prebuilt (pkg fetch) or locally built
(make package) packages by:

  1) untarring the .pkg:
     cd /tmp && tar xzvf {/usr/ports/packages/All,/var/cache/pkg}/...

  2) unpacking the manifests:
    cat -- +COMPACT_MANIFEST | jq -a 'del(.shlibs_required,.deps)' > \
        COMPACT_MANIFEST.tmp
    cat -- +MANIFEST | jq '.' > MANIFEST.tmp

  3) removing unecessary files and dependencies:
     vi *MANIFEST.tmp
       :s/DOCS": "on/DOCS": "off/
       :g,share/doc,d
       ...
     rm -rf ./usr/local/{same files and deps as vi}

  4) and repacking into a new, minimal pkg:
     mv COMPACT_MANIFEST.tmp +COMPACT_MANIFEST && \
     mv MANIFEST.tmp +MANIFEST && \
     tar cf - ... | (cd / && tar xfBp -) && \
     pkg create -M +MANIFEST

This tends to be easier than patching port/{Makefile,pkg-plist,files/...},
keeps /var/db/pkg/local.sqlite valid and works well with 'pkg audit'.
Should also, theoretically, be easy enough to roll into a metaport.

Thanks to Devin for the original idea.

YMMV,
Roger



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?>