Upgrade using nano in lieu of vi

With FreeBSD 12.1-RELEASE-p11 as my NomadBSD 1.3 starting point:

  1. open Sakura
  2. pkg install nano
  3. echo "set --export EDITOR /usr/local/bin/nano" >> ~/.config/fish/config.fish
  4. echo "set --export VISUAL /usr/local/bin/nano" >> ~/.config/fish/config.fish
  5. sudo echo "setenv EDITOR /usr/local/bin/nano" >> /private/home/nomad/.cshrc
  6. sudo echo "setenv VISUAL /usr/local/bin/nano" >> /private/home/nomad/.cshrc
  7. open a new tab
  8. sudo freebsd-update -r 12.2-RELEASE upgrade

– still, for files that can not be merged automatically, there’s the direction to

… edit this file in /usr/bin/vi and resolve the conflicts manually…

Please, what am I missing?

How can I force the upgrade routine to not drop me down the vi rabbit hole?

You should set it also in /etc/profile. freebsd-update is run by root who uses sh(1) as shell.

1 Like

Thanks!

Not mentioned in the opening post but I did also set variables in

/private/home/nomad/.profile

I edited

/etc/profile

– then retried the upgrade command, again it directed me to use vi.

OS restarted, I’ll retry and if necessary take a closer look.

I thought I set the variables correctly but I don’t see them in env of sh for root.

Please, how exactly should I make the entries in /etc/profile?

export EDITOR=nano

Thanks, done, but still I don’t see the variable when I run sh then env as root.

My mistake. To edit the relevant files I was routinely using nano after sh then editing without specifying a path and forgetting to cd

Still, I get this, for example:

The following file could not be merged automatically: /etc/freebsd-update.conf
Press Enter to edit this file in /usr/bin/vi and resolve the conflicts
manually...

/etc/profile was probably the solution although I lost track of the range of changes with which I experimented!

Ultimately I got what I wanted by not taking this approach:

sudo freebsd-update -r 12.2-RELEASE upgrade

– instead:

sudo su followed by freebsd-update -r 12.2-RELEASE upgrade

sudo -E freebsd-update ...
should also work. -E keeps your environment variables.

2 Likes

That absolutely worked. Thank you very much for that post. Happy New Year.

1 Like