FreeBSD: Upgrading Ports
Legal (copyleft): Permission to copy and derive is granted freely.
No guarantees. Use at your own risk.
Document created in 2010.
[2010/11]
IMPORTANT: ARCHIVE BEFORE UPGRADING PORTS!
DISCLAIMER: AUTHOR WILL NOT BE HELD RESPONSIBLE FOR A BROKEN SYSTEM NOR LOST DATA!
I strongly suggest to NOT upgrade ports unless absolutely necessary.
If FreeBSD works, leave it alone.
I've had trouble with other ways of upgrading ports.
Trying to compile new ports with a mess of old ports has often failed.
The way I upgrade ports is to start from scratch.
- A pristine archive of /usr/local and /var/db/pkg is required.
- Record what packages were installed:
pkg_info > /installed_packages
- Archive BOTH /usr/local -AND- /var/db/pkg
The installed ports and the ports database are bound together.
tar cfjv /local/bak/usr_local_var_db_pkg.tar.bz2 usr/local var/db/pkg
- Also archive other critical system dirs:
tar cfjv /local/bak/boot.tar.bz2 boot
tar cfjv /local/bak/etc.tar.bz2 etc
tar cfjv /local/bak/usr_ports.tar.bz2 usr/ports
...
- Remove the old /usr/ports and untar the new ports.tar.gz from freebsd.org.
- First trying fetching all the ports you plan to install:
make fetch
- Stop X Windows, login to a text-mode console.
- Restore the pristine /usr/local and /var/db/pkg
The reason is that building new ports with old ports installed
might cause build problems, but building from a pristine system works better
(apparently the FreeBSD developers test compiling ports on a pristine system).
- Build the new ports.
There's a possibility a port will fail to compile.
SO YOU BETTER HAVE AN ARCHIVE OF THE OLD PORTS!