Backup and restore compiled ports

So I am doing a fresh install on a new computer but want to keep the 400+ ports I have built. OS versions will be the same (11). After doing a clean install and copying my custom /boot/loader.conf, /etc/sysctl.conf and /etc/rc.conf, can I just restore dumps of /var/db and /usr/local? I just want to make sure I keep everything referencing installed user software in sync.
 
For this particular situation you could also consider ports-mgmt/portmaster. Using the --list-origins option you can generate a list of all the 'root' and 'leaf' ports which you installed. This list can then be fed into the new Portmaster installation to re-install (rebuild) all the ports currently in use.
 
Thanks for the replies - I was trying to avoid rebuilding the ports I had but it seems I may have to. I have walked down the path of using systems to build custom packages and although I like the idea, I had some issues so have gone back to ports-mgmt/portmaster because I am comfortable with it and it works well. Since this is a desktop, I also did not create separate file systems for /var and /usr so I am unable to dump those. No worries, I don't really have any ports installed that take a long time to build: I use a lightweight wm and I think the "biggest" build I have is editors/libreoffice. I was just looking for an easier way to transfer everything and also to do an actual restore, which I have never done.I like doing things like this so I can learn how.

Thanks again!
 
Well, ports-mgmt/pkg does that as well:

pkg query -e '%#r=0' '%o'

That reads out as "installed packages that have no reverse dependencies", in other words all of the "leaf" ports (packages) that are not required by other ports. Output as the origin ports instead of the package names.

Edit: There seems to be an alias for the very functionality already:

pkg leaf

This doesn't however output the origin ports but the package names only.
 
If you like to keep using portmaster(8) have a look at its -g option. That will automatically create a package once it's done building.

This doesn't however output the origin ports but the package names only.
It's been a while but can't that list be used as input for pkg-create(8)? That would create a package of all the installed ports.
 
If you like to keep using portmaster(8) have a look at its -g option. That will automatically create a package once it's done building.


It's been a while but can't that list be used as input for pkg-create(8)? That would create a package of all the installed ports.

That's only the leaves, if you're taking a package backup you want the package files of all installed packages. If you're going to rebuild ports you need only leaf ports as port origins.
 
I really liked the idea of the package build systems and played with one but it wanted to rebuild a large port (webkit?) every time I did a ports tree update. Probably because there was an issue with the port but it became cumbersome to use so I moved back to ports-mgmt-portmaster. I don't really mind rebuilding everything - did it when I moved from 10.3 to 11.0. I am moving from a 12 core Xeon system to a 4 core i7 so the builds will take longer but it's OK. I have created a dump of / which includes /var/db and /usr/local so a restore should put me back to where I am now. If not, I actually like compiling, having come from Gentoo Linux. Pretty geekish, I know ;)
 
I also did not create separate file systems for /var and /usr so I am unable to dump those.
From my understanding it should be possible by changing everything else on / to nodump using chflags(1). A later restore should then just add the dumped files. Please correct me if I am wrong.
 
Back
Top