The current NanoBSD documentation demonstrates how to add packages to your image, but uses the
I used this method to add packages to my images, which seems to work well. For example to add python to the image:
In /usr/obj/nanobsd.nano/_.cust.install_packages the output of the above command is shown. In this case:
A difference with the original example is that for this case the packages are downloaded for every build, instead of copied from the filesystem.
In both the documented and above example you must be able to chroot into the tree being build, which must somehow limit your cross-build options (but I haven't tested it). I'm building an i386 image on a amd64 system and that works fine (packages from the right ABI are installed in the image).
What do you think? I'm looking forward on your feedback, I'll propose a documentation modification if it turns out to be working for you as well.
pkg_add
command to do so. This is no longer working on FreeBSD 10 or later.I used this method to add packages to my images, which seems to work well. For example to add python to the image:
Code:
install_packages () (
#pkg -c ${NANO_WORLDDIR} install -y <package-name>
pkg -c ${NANO_WORLDDIR} install -y python
# remove diskspace used by pkg
chroot ${NANO_WORLDDIR} sh -c 'rm -rf /var/cache/pkg var/db/pkg'
)
customize_cmd install_packages
In /usr/obj/nanobsd.nano/_.cust.install_packages the output of the above command is shown. In this case:
Code:
+ install_packages
+ pkg -c /usr/obj/nanobsd.nano//_.w install -y python
Updating FreeBSD repository catalogue...
Fetching meta.txz... done
Fetching packagesite.txz... done
Processing entries... done
FreeBSD repository update completed. 24160 packages processed.
The following 6 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
python: 2.7_2,2
python27: 2.7.9_1
libffi: 3.2.1
indexinfo: 0.2.3
gettext-runtime: 0.19.4
python2: 2_3
The process will require 64 MiB more space.
10 MiB to be downloaded.
Fetching python-2.7_2,2.txz... done
Fetching python27-2.7.9_1.txz... done
Fetching libffi-3.2.1.txz... done
Fetching indexinfo-0.2.3.txz... done
Fetching gettext-runtime-0.19.4.txz... done
Fetching python2-2_3.txz... done
Checking integrity... done (0 conflicting)
[1/6] Installing indexinfo-0.2.3...
[1/6] Extracting indexinfo-0.2.3... done
[2/6] Installing libffi-3.2.1...
[2/6] Extracting libffi-3.2.1... done
[3/6] Installing gettext-runtime-0.19.4...
[3/6] Extracting gettext-runtime-0.19.4... done
[4/6] Installing python27-2.7.9_1...
[4/6] Extracting python27-2.7.9_1... done
[5/6] Installing python2-2_3...
[5/6] Extracting python2-2_3... done
[6/6] Installing python-2.7_2,2...
[6/6] Extracting python-2.7_2,2... done
Message for python27-2.7.9_1:
=====================================================================
Note that some standard Python modules are provided as separate ports
as they require additional dependencies. They are available as:
bsddb databases/py-bsddb
gdbm databases/py-gdbm
sqlite3 databases/py-sqlite3
tkinter x11-toolkits/py-tkinter
=====================================================================
A difference with the original example is that for this case the packages are downloaded for every build, instead of copied from the filesystem.
In both the documented and above example you must be able to chroot into the tree being build, which must somehow limit your cross-build options (but I haven't tested it). I'm building an i386 image on a amd64 system and that works fine (packages from the right ABI are installed in the image).
What do you think? I'm looking forward on your feedback, I'll propose a documentation modification if it turns out to be working for you as well.