Solved update-alternatives for FreeBSD

Hello,

when calling the gpg command I want gpg2 to be executed instead of gpg1. Both programs are installed. In Linux I used update-alternatives for that. What would be the equivalent in FreeBSD?

Thank you.
 
update-alternatives is only Linux command..
FreeBSD isn't another Linux distribution. FreeBSD is Unix like system.
 
update-alternatives create link to pragram which you choose
[yampress@debian /etc/alternatives]$ ls -al
razem 52
drwxr-xr-x 2 root root 4096 wrz 9 08:04 .
drwxr-xr-x 138 root root 12288 wrz 17 10:28 ..
lrwxrwxrwx 1 root root 20 sie 10 16:23 animate -> /usr/bin/animate-im6
lrwxrwxrwx 1 root root 36 sie 10 16:23 animate.1.gz -> /usr/share/man/man1/animate-im6.1.gz
lrwxrwxrwx 1 root root 13 sie 10 16:36 awk -> /usr/bin/gawk
lrwxrwxrwx 1 root root 29 sie 10 16:36 awk.1.gz -> /usr/share/man/man1/gawk.1.gz
lrwxrwxrwx 1 root root 38 sie 10 15:00 builtins.7.gz -> /usr/share/man/man7/bash-builtins.7.gz
lrwxrwxrwx 1 root root 16 sie 10 16:22 c89 -> /usr/bin/c89-gcc
lrwxrwxrwx 1 root root 32 sie 10 16:22 c89.1.gz -> /usr/share/man/man1/c89-gcc.1.gz
lrwxrwxrwx 1 root root 16 sie 10 16:22 c99 -> /usr/bin/c99-gcc
lrwxrwxrwx 1 root root 32 sie 10 16:22 c99.1.gz -> /usr/share/man/man1/c99-gcc.1.gz
lrwxrwxrwx 1 root root 12 sie 10 16:22 cc -> /usr/bin/gcc
lrwxrwxrwx 1 root root 13 sie 10 16:23 cli -> /usr/bin/mono
....
lrwxrwxrwx 1 root root 17 sie 10 15:01 w -> /usr/bin/w.procps
lrwxrwxrwx 1 root root 33 sie 10 15:01 w.1.gz -> /usr/share/man/man1/w.procps.1.gz
lrwxrwxrwx 1 root root 18 sie 10 15:01 write -> /usr/bin/bsd-write
lrwxrwxrwx 1 root root 34 sie 10 15:01 write.1.gz -> /usr/share/man/man1/bsd-write.1.gz
lrwxrwxrwx 1 root root 39 sie 10 17:02 x-cursor-theme -> /usr/share/icons/DMZ-White/cursor.theme
lrwxrwxrwx 1 root root 17 sie 10 16:23 x-session-manager -> /usr/bin/startkde
lrwxrwxrwx 1 root root 16 sie 10 16:23 x-terminal-emulator -> /usr/bin/konsole
lrwxrwxrwx 1 root root 17 sie 10 16:23 x-window-manager -> /usr/bin/kwin_x11
lrwxrwxrwx 1 root root 23 sie 10 16:33 x-www-browser -> /usr/bin/vivaldi-stable
[yampress@debian /etc/alternatives]$

You can do this by hand.... without update-alternatives. But tool update-alternatives show to you another alternatives
Code:
ln -s   /usr/bin/vivaldi-stable    /etc/alternatives/x-www-browser

alias in FreeBSD is easier and It's similar way to do the same action.
 
alias in FreeBSD is easier and It's similar way to do the same action.
Not really. Shell aliases are local to your shell only. Scripts and other shells won't see it. Using a symlink or wrapper script makes gpg available globally.

Use a symlink:
ln -s /usr/local/bin/gpg2 /usr/local/bin/gpg (or link to somewhere else in your PATH if you don't want to touch /usr/local/bin)

But security/gnupg automatically creates a /usr/local/bin/gpg symlink for you, unless you also have security/gnupg1 installed. You don't have to do this yourself if you only use one of them.
 
Back
Top