From 6ef80d5847ad259f501eaceb2b1bff92be1507d6 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Wed, 17 Jan 2024 16:15:52 +0100 Subject: [PATCH] Add a default message of the day (/etc/motd) This is injected to the factory-config during bootstrap, and can then be changed as usual via /system/motd. --- board/common/rootfs/etc/motd | 4 ++++ src/confd/bin/Makefile.am | 2 +- src/confd/bin/bootstrap | 1 + src/confd/bin/gen-motd | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 board/common/rootfs/etc/motd create mode 100644 src/confd/bin/gen-motd diff --git a/board/common/rootfs/etc/motd b/board/common/rootfs/etc/motd new file mode 100644 index 00000000..8162a149 --- /dev/null +++ b/board/common/rootfs/etc/motd @@ -0,0 +1,4 @@ +.-------. +| . . | Infix -- a Network Operating System +|-. v .-| https://kernelkit.github.io +'-'---'-' \ No newline at end of file diff --git a/src/confd/bin/Makefile.am b/src/confd/bin/Makefile.am index eeecba4a..134fd6b2 100644 --- a/src/confd/bin/Makefile.am +++ b/src/confd/bin/Makefile.am @@ -1,2 +1,2 @@ pkglibexec_SCRIPTS = bootstrap error load \ - gen-hostkeys gen-admin-auth gen-hostname gen-interfaces + gen-hostkeys gen-admin-auth gen-hostname gen-interfaces gen-motd diff --git a/src/confd/bin/bootstrap b/src/confd/bin/bootstrap index b449dd60..299a40de 100755 --- a/src/confd/bin/bootstrap +++ b/src/confd/bin/bootstrap @@ -97,6 +97,7 @@ factory() # Create an overlay for /etc/hostname to change the default in an br2-external gen-hostname >"$FACTORY_D/20-hostname.json" + gen-motd >"$FACTORY_D/20-motd.json" # shellcheck disable=SC2086 gen-interfaces $GEN_IFACE_OPTS >"$FACTORY_D/20-interfaces.json" diff --git a/src/confd/bin/gen-motd b/src/confd/bin/gen-motd new file mode 100644 index 00000000..e73f22f1 --- /dev/null +++ b/src/confd/bin/gen-motd @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +if [ -f /etc/motd ]; then + cat <