How to use cached packages

Miroslav Lachman 000.fbsd at quip.cz
Thu Apr 20 21:18:38 UTC 2017


Freddie Cash wrote on 2017/04/20 22:39:
> On Thu, Apr 20, 2017 at 1:36 PM, Miroslav Lachman <000.fbsd at quip.cz
> <mailto:000.fbsd at quip.cz>>wrote:
>
>     Freddie Cash wrote on 2017/04/20 22:17:
>
>         On Thu, Apr 20, 2017 at 11:58 AM, Patrick Powell
>         <papowell at astart.com <mailto:papowell at astart.com>>
>         wrote:
>
>             I ran into a problem where I needed to reinstall a package.
>             However,  I
>             did not have network access to the pkg repository.  I did
>             have a system
>             which had all of the pkgs which I needed in the pkg cache.
>             I can easily
>             copy these to the system,  as well as the pkg database, etc.
>
>             So:  is there a SIMPLE way to have pkg check to see if a pkg
>             is already in
>             the pkg cache and use that before trying to go to the
>             repository?
>
>             Is there a SIMPLE way to prevent pkg from trying to check
>             the pkg
>             repository for an update?
>
>             I strongly suspect that something like:
>
>             pkg --do_not_check_for_latest_version --use_cached_pkg
>             install firefox
>
>             Any help on this before I tear out the three strands of hair
>             I have left
>             would be appreciated.
>
>
>
>         ​If you have the .txz/.tbz package file, then it's a simple:
>
>         # pkg install /path/to/firefox-versions-blahblah.txz
>
>
>     I think it is "pkg add /var/cache/pkg/firefox-versions-blahblah.txz"
>
>
> ​Both work.  "pkg add" is there for backward compat with the old way
> (pkg_add).  "pkg install" can install from remote repos or local files.
> From the man pages:
>
> ​DESCRIPTION
>       pkg install is used for installation of packages from package
> reposito-
>       ries or local archives.  Multiple package names can be specified
> on the
>       command line, either explicitly orby matching against package
> names (or
>       origins) in the repositorycatalogues using shell globbingor regular
>       expressions.
>
>
> DESCRIPTION
>       pkg add installs packages from either a local source or a remote one.
>
>       When installing from a remote source you need to specify the
> protocol to
>       use when fetching the package.
>
>
> ​For ease of use, "pkg install" works for everything.  :)​

I do not remember exactly why I am using pkg add. Maybe pkg install did 
not work for me in the past (when downgrading from /var/cache/pkg) or 
maybe because pkg add will not try to fetch from repo defined in 
/usr/local/etc/

Anyway good to know both works :)

Miroslav Lachman



More information about the freebsd-ports mailing list