From e63f62ff12e12530207a276f47f259ebdbe0de43 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Tue, 4 Jun 2024 09:00:55 +0200 Subject: [PATCH] mkmotd: Be less intrusive Avoid dumb "to bee or not to bee" saying. Avoid three out of four asterisks. Avoid showing anything for empty policy Seperate tags and policy by additional vertical space Old: ``` # # ### # # stairwaytoheaven ## ## ## ##### # # # # # system Supermicro 2023US-TR4 # # # # # # # # # # # # # cpu 128x AMD EPYC 7601 # # # # # # # # # # # 64 ram 1027.6 GB # # ###### ##### # # # # # arch x86_64 / 64-bit # # # # # # # # # # # glibc 2.36 # # # # # # ### #### # # kernel 5.15.131.mx64.457 #1 / to bee or not to bee / tags: amd confidential hitparade mx64 mxqd server ** MXQ cluster node - only to be used via mxqsub/mxqi ** ** Access to confidential data enabled ** ``` new: ``` # # ### # # stairwaytoheaven ## ## ## ##### # # # # # system Supermicro 2023US-TR4 # # # # # # # # # # # # # cpu 128x AMD EPYC 7601 # # # # # # # # # # # 64 ram 1027.6 GB # # ###### ##### # # # # # arch x86_64 / 64-bit # # # # # # # # # # # glibc 2.36 # # # # # # ### #### # # kernel 5.15.131.mx64.457 #1 tags: amd confidential hitparade mx64 mxqd server * MXQ cluster node - only to be used via mxqsub/mxqi * Access to confidential data enabled ``` --- mkmotd/mkmotd.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mkmotd/mkmotd.pl b/mkmotd/mkmotd.pl index 196537c1..8da25dcc 100755 --- a/mkmotd/mkmotd.pl +++ b/mkmotd/mkmotd.pl @@ -43,7 +43,7 @@ EOF - $TEMPLATE .= " / to bee or not to bee / tags: ".join(" ",@hostconfig)."\n"; + $TEMPLATE .= " tags: ".join(" ",@hostconfig)."\n\n"; } else { die "$os_release : unknown os_release\n"; @@ -201,5 +201,7 @@ sub policy { # policy('theinternet') --> ('zeile1,'zeile2',....) $TEMPLATE =~ s/%(\S+?)%/$T{$1}||$1/eg; open O, '>', '/etc/motd' or die "/etc/motd: $!\n"; -print O $TEMPLATE, ( join( "\n", map ( " ** $_ **", policy( $T{HOST} ) ) ) || " ** **" ), "\n\n"; +print O $TEMPLATE; +my @policy = policy($T{HOST}); +print O join("\n", map(" * $_", @policy)), "\n\n" if @policy; close O;