commit f6ba8afa45eb308231b195fc3152a6ca0cb61539
parent ff427e65c3737322eee3eca97680b577ce4eae68
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date: Tue, 26 Jul 2022 18:03:25 +0200
Generate /etc/motd
Diffstat:
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/install b/install
@@ -23,6 +23,7 @@ die111() { # 111: system call failed
}
install_to_all() {
+ local orig_cwd=$PWD
cd $ALL_DIR || exit $?
mkdir s6-rc-source || exit $?
./command/fsapply ./s6-rc-source $PWD/conf/s6-rc.fileset || exit $?
@@ -34,6 +35,10 @@ install_to_all() {
for cmd in init/bin/*; do
s6-ln -s ../$cmd ./command/$cmd:t || exit $?
done
+ cat >motd <<EOF
+Welcome to $(<conf/static/etc/hostname)!
+This system has configuration managed in $orig_cwd (last change on $(GIT_DIR=$orig_cwd/.git git show -s --pretty=format:%ai by %an))
+EOF || exit $?
}
typeset -f -t install_to_all
diff --git a/postinstall b/postinstall
@@ -76,6 +76,12 @@ setup_static_symlinks() {
symlink_static_file /etc/mkinitfs/mkinitfs.conf || return $?
symlink_static_file /etc/ssh/sshd_config || return $?
symlink_static_file /etc/update-extlinux.conf || return $?
+
+ # Not static, generated in ./install
+ if [[ ! -L /etc/motd && -f /etc/motd ]]; then
+ mv /etc/motd /etc/motd.orig.$EPOCHSECONDS || exit $?
+ fi
+ ensure_symlink /etc/motd ../current/motd || return $?
}
setup_storage() {