rset(1) : Formulas

Setting the Login Message

rset is named thusly because it executes scripts in order on remote hosts, however it is also possible to pull in some context from your local environment. Starting with the 2.1 release, the output of local commands defined between { and } is prepended to a label.

Simple Message on BSD

To quote the OpenBSD motd man page:

During system startup, a line containing the kernel version string replaces all lines up to (but not including) the first blank line of this file. Customized messages can be added to this file after that first blank line.

Therefore to properly manage this file we can delete all but the first line

    sed -i -n '1p;' /etc/motd
    cat apu4d2/motd >> /etc/motd

This works, but doesn't give us a diff of changes. To accomplish this, we can construct a new file to install

    head -n 1 /etc/motd >
    cat xa10/motd >>
    ./rinstall /etc/motd

Using Local Execution

The following demonstrates the local execution context used to customize /etc/motd with information of who ran the configuration

    echo "CONFIGURE_HOST=$(hostname)"
    echo "CONFIGURE_USER=$(whoami)"
    cat > /etc/motd <<-EOF
    `head -n 1 /etc/motd`
    `cat xa10/motd`

    Last configured by $CONFIGURE_USER from $CONFIGURE_HOST

Last updated on June 17, 2021