Create offline package with all dependencies

Is there a way to use pkg-create to create a package (for example openjdk17) that when installed does not require any internet access at all? (that is, to include all it's dependencies)
Also, can I do pkg-create -a and create a complete repo of my local packages in the same fashion, such as these then need no internet access nor perform any updates?
 
Must it be a single package?

If not, you can get all the transitive dependencies for a package with pkg fetch -Udo $TEMP_DIR $PACKAGE_NAME.
That will put all of the packages in $TEMP_DIR. You can distribute those.
Using pkg-fetch(8) will re-download those file, which is not ideal. If you don't want that, you can use the list it prints to copy them from /var/cache/pkg or wherever your pkg cache is.

You can install the with pkg add -A $TEMP_DIR/All/Hashed/*.pkg.
Then pkg set -A0 $PACKAGE_NAME to mark the target package as not automatic (not a dependency).
 
They'll just be downloaded to $TEMP_DIR. That's what the -U option does. It does not attempt to update the package database. I'm not sure its actually necessary.
 
Is there a way to use pkg-create to create a package (for example openjdk17) that when installed does not require any internet access at all? (that is, to include all it's dependencies)
Also, can I do pkg-create -a and create a complete repo of my local packages in the same fashion, such as these then need no internet access nor perform any updates?
Code:
     package          Make a binary package for the port.  The port will be
                      installed if it has not already been.  The package is a
                      .pkg file that you can use to install the port on other
                      machines with pkg-add(8).  If the directory specified by
                      PACKAGES does not exist, the package will be put in
                      /usr/ports/category/port/work/pkg.  See PKGREPOSITORY
                      and PKGFILE for more information.

     package-recursive
                      Like package, but makes a package for each depending
                      port as well.
ports(7)
 
Code:
     package          Make a binary package for the port.  The port will be
                      installed if it has not already been.  The package is a
                      .pkg file that you can use to install the port on other
                      machines with pkg-add(8).  If the directory specified by
                      PACKAGES does not exist, the package will be put in
                      /usr/ports/category/port/work/pkg.  See PKGREPOSITORY
                      and PKGFILE for more information.

     package-recursive
                      Like package, but makes a package for each depending
                      port as well.
ports(7)
Thank you! Does this work for packages that are installed from binaries though? How do I get access to `ports` ? Do I have to install ports-tools-1.8 ?
Thanks again!
 
Awesome, thank you! I checked it out but I was looking for something a bit more straightforward than using `make` or `ports`. But anyway, I think your solution is the best, I might simply download the zip files the ports I'm interested in and then build them, although for example, mysql 8.0.33, when I download the port zip and use make to build, it starts downloading boost and other tools that I wish I had them from the get go and no need to download them, you know what I mean?
Thanks anyway for all the pointers ,they help a lot whilst I switch from Linux to BSD!
 
Also, do you guys have any specific tool you recommend for an FreeBSD noobie to manage ports? I need something that allows me to extract/download specific versions of specific ports, I wish to avoid cloning the complete port tree and/or only using the latest port versions.
 
it starts downloading boost and other tools that I wish I had them from the get go and no need to download them, you know what I mean?
It's going to try to build all its (missing) dependencies first. You can circumvent this with make install-missing-packages. That will install all its dependencies as packages, saving you some build time.

Code:
     install-missing-packages
                Install missing dependencies from packages instead of building
                them.

Also, do you guys have any specific tool you recommend for an FreeBSD noobie to manage ports
De facto standard tool is ports-mgmt/poudriere, it's the tool that's used to create the FreeBSD package repositories. Besides building everything in the ports tree, it can build just a selection of ports, so you can tell it to only build what you need.


I need something that allows me to extract/download specific versions of specific ports, I wish to avoid cloning the complete port tree and/or only using the latest port versions.
While certainly possible you're going to run into issues with missing dependencies. So it's often a lot easier to get a complete ports tree. Ports tree itself isn't too big, it's all text files, will go great if you use compression on the filesystem.
 
Back
Top