rset(1) : Formulas

Multiple Platforms

rset is does not have a discovery or fact-gather phase. Instead scripts are run in the remote environment, and can therefore test for any property.

Linux Distributions

On Linux distributions using systemd we can usually get at OS details in /etc/os-release. This file is difficult to parse, but happens to be valid shell expression.

Attempting to abstract the package manager does not help since the conventions for choosing versions and even naming conventions vary. The easiest and most readable way to handle this is with case statements

packages:
   case $(. /etc/os-release; echo $ID) in
       rocky|almalinux)
           dnf -y install vim the_silver_searcher
           ;;
       ubuntu)
           apt -y install vim silversearcher-ag
           ;;
   esac

Berkeley Distributions

Detecting the variant of BSD is straightforward

packages:
   case $(uname) in
       OpenBSD)
           pkg_install vim--no_11 the_silver_searcher
           ;;
       FreeBSD)
           pkg install vim-tiny the_silver_searcher
           ;;
   esac