There are several ways of tackling this problem, any permutation of which might also work, depending on what you're trying to do.
The following advice is based on my use of pkgsrc in OpenIndiana, so bear in mind that things may be different if you're on a different OS.
Let's define 2 terms:
OldMachine
= the machine you're migrating from
NewMachine
= the machine you're migrating to
Before you begin, take a look at the pkgin
(pkgsrc's package manager) documentation; you'll need to become familiar with it.
Tasks
This section has a list of possible tasks that may or may not be relevant depending on your goal(s) (see below.)
1: Generate a list of installed packages on OldMachine
# pkgin list
I do believe you can save the output to a text file via:
# pkgin list >> /Path/To/List/Of/Packages.list
Don't worry about the .list
extension; any text editor will still read the file.
2: Bootstrap OldMachine
's pkgsrc branch on NewMachine
Check your OS-specific pkgsrc documentation on how to determine which branch you're on and then how to bootstrap that branch. For example, here's Illumos'.
3: Install generated list of packages on NewMachine
There are several ways to do this, including, but not necessarily limited to:
- Write a script or command that does
# pkgin -y install
for all the packages in Packages.list
- In a text editor, turn
Packages.list
from a vertical list to a horizontal one. You can do this manually or via RegEx. Here's an example of how to do it in Sublime Text. Then copy and paste that text to the end of the # pkgin -y install
- Write a single line command that does it. I'm sure those exist; I just don't know how to write one myself offhand
4: Import package settings from OldMachine
You'll have to manually find all your .conf (or similar) files that you customized and then transfer them to their matching locations on NewMachine
's filesystem, making sure that the contents of each file don't refer to invalid locations/settings/etc. on NewMachine
Goals
This section has possible goals, followed by the appropriate combination of the above tasks to achieve them:
A1: You want to simply install the latest versions of all the same packages (recommended)
Tasks 1 & 3
A2: You want to do A1 + import settings
Tasks 1, 3, & 4
B1: You want to install a particular branch version of the packages
Tasks 1 - 3
B2: You want to do B1 + import settings
Tasks 1 - 4