Ports - saving your work

From FBSD_tips

Jump to: navigation, search

DRAFT

[edit] Rationale

When configuring a FreeBSD system one of the first questions is : "do I install form ports or packages?", the answer is of course : "Yes.". Let me explain. There really is no 'difference' between a port and a package, a package is a (potential) product of a port. Ports have many targets, e.g. install, clean, package. If you are installing a large port you can "save you work" by making the target 'package' (and it's sister, package-recursive, for all dependancies) as a pkg_add -able file!

[edit] Example

As the ports tree gets unpacked, it lasks the directory /usr/ports/packages/All. Without this directory packages will be stored in the port's directory, this is inconvenient. So make the directory.

> mkdir -p /usr/ports/packages/All
>

Now make a port and all it's dependancy packages.

> cd /usr/ports/shells/bash
> make package-recursive
===>  Vulnerability check disabled, database not found  
=> bash32-026 doesn't seem to exist in /usr/ports/distfiles/bash.
=> Attempting to fetch from http://ftp.gnu.org/gnu/bash/bash-3.2-patches//.
... long compilation snipped ...

Now bash and it's deps (libiconv and gettext) are all installed.

> pkg_info
bash-3.2.33         The GNU Project's Bourne Again SHell
gettext-0.16.1_3    GNU gettext package
libiconv-1.11_1     A character set conversion library
libtool-1.5.24      Generic shared library support script
> ls -ltr /usr/ports/packages/All/
-rw-r--r--  1 root  wheel    598545 Mar  2 07:55 bash-3.2.33.tbz
-rw-r--r--  1 root  wheel   2135868 Mar  2 07:55 gettext-0.16.1_3.tbz
-rw-r--r--  1 root  wheel    394354 Mar  2 07:56 libtool-1.5.24.tbz
-rw-r--r--  1 root  wheel   1481413 Mar  2 07:56 libiconv-1.11_1.tbz


We can deinstall bash and it deps.

> pkg_delete -r bash-3.2.33
> pkg_info
>

And we don't have to recompile to get it back.

> pkg_add /usr/ports/packages/All/bash-3.2.33
> pkg_info
bash-3.2.33         The GNU Project's Bourne Again SHell
gettext-0.16.1_3    GNU gettext package
libiconv-1.11_1     A character set conversion library
libtool-1.5.24      Generic shared library support script

[edit] Discussion

The environment variable PACKAGES controls where the packages get put. If you wanted to prepare a set of packages with special options and keep them separated you could do it using this variable. The article Ports building options goes into greater detail on this and other ports customization t\opics.

Personal tools