1

I am unaware if there is a specific term for what I mean by "freezing". What I am looking for is a command that is the pkgsrc counterpart to:

  • the pip freeze command for Python repositories
  • the brew bundle dump command from Homebrew

My motivation behind is to easily migrate my system from one machine to another.

Ajay Sivan
  • 2,807
  • 2
  • 32
  • 57
Leon
  • 13
  • 3

1 Answers1

0

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:

  1. Write a script or command that does # pkgin -y install for all the packages in Packages.list
  2. 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
  3. 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

jdrch
  • 70
  • 2
  • 6
  • Thank you for your answer! Actually, what I want to know is the last part of your last sentence. That is, is there a simple command to (a) "generate [the list of source packages] on the source machine" (especially only those which will load all the other packages because of dependencies) and (b) "install the list of source packages". – Leon Apr 11 '20 at 15:15
  • @Leon I edited my original reply to add the details you're looking for – jdrch Apr 12 '20 at 14:53
  • I just found out a couple of hours ago that there exist `pkgin export` and `pkgin import`, see the [examples on the pkgin site](https://pkgin.net/#examples). – Leon Apr 13 '20 at 15:35
  • @Leon Excellent. Amazing what happens when you read documentation (and I say that for myself too.) I've never attempted what you're trying to do so I'd never looked into those features. – jdrch Apr 13 '20 at 19:22