Skip to content

Commit

Permalink
mkmotd: Be less intrusive
Browse files Browse the repository at this point in the history
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

```
  • Loading branch information
donald committed Jun 4, 2024
1 parent 3bc4cf4 commit e63f62f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mkmotd/mkmotd.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;

0 comments on commit e63f62f

Please sign in to comment.