Re: Remove a port without removing files

From: Eugene Grosbein <eugen_at_grosbein.net>
Date: Wed, 06 Oct 2021 01:43:26 UTC
06.10.2021 0:03, Per olof Ljungmark wrote:

> As the subject says, I need to remove a port so pkg etc does not care about it, but keeping all the ports files intact.

A package is just a tar.xz archieve and you may create it from installed port
with "pkg create" command like this:

pkg create zfs-stats-1.3.0

It is not possible to remove a port without removing files but you may create a package beforehand
as shown above, then pkg delete it, then use:

tar --exclude '+*' -C / -xkvf zfs-stats-1.3.0.pkg

This tar command extracts removed files back without registering the package.
Note that "pkg delete" will not remove files of the port that were modified
after installation (config files etc.) and tar command will not overwrite them, too
due to -k flag.