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.
This commit is contained in:
Tobias Waldekranz
2024-01-18 00:02:55 +01:00
committed by Joachim Wiberg
parent 43fbe4e8b1
commit 6ef80d5847
4 changed files with 21 additions and 1 deletions
+4
View File
@@ -0,0 +1,4 @@
.-------.
| . . | Infix -- a Network Operating System
|-. v .-| https://kernelkit.github.io
'-'---'-'
+1 -1
View File
@@ -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
+1
View File
@@ -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"
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
set -e
if [ -f /etc/motd ]; then
cat <<EOF
{
"ietf-system:system": {
"infix-system:motd": "$(sed ':a;N;$!ba;s/\n/\\n/g;s/\t/\\t/g' /etc/motd)"
}
}
EOF
else
echo "{}"
fi