#!/bin/sh # # c64banner A Linux dynamic /etc/motd that prints a "READY" login message. # Tested on Ubuntu Yakkity (16.10). # # This banner announces when the computer is "READY" for your commands, to # avoid losing them in "buffer hole". # # INSTALLATION: # # The following steps install this dynamic motd on Ubuntu Yakkity. # # 1. Install in /etc/update-motd.d. This assums your OS has the dynamic motd # software; if not, then you'll either need to add it or use a different way # to do dynamic motds. Here's how I did it on Ubuntu Yakkity: # # $ sudo mv /etc/update-motd.d /etc/update-motd.d.orig # $ sudo mkdir /etc/update-motd.d # $ sudo cp c64banner.sh /etc/update-motd.d/00-c64banner # $ sudo chmod 755 /etc/update-motd.d/00-c64banner # # That puts the old motd scripts in a .orig directory, if you want to switch # back later. # # 2. Move aside old /etc/motd if needed. # # $ sudo mv /etc/motd /etc/motd.orig # # If it complains about "No such file or directory", then consider this step # completed anyway. # # 3. Check that pam will invoke it: # # $ grep motd /etc/pam.d/sshd # # and a static (admin-editable) part from /etc/motd. # session optional pam_motd.so motd=/run/motd.dynamic # session optional pam_motd.so noupdate # # Note the 2nd line of output, which has "...motd.dynamic". If you are missing # such a dynamic line, add it. Do the same to /etc/pam.d/login. # # 4. Turn off SSH "Last login:" message, if needed. It's here: # # $ grep PrintLastLog /etc/ssh/sshd_config # PrintLastLog yes # # Change that to be "no". # # 5. Turn off pam's "Last login:" message for console logins, if needed. # # $ grep pam_lastlog /etc/pam.d/* # /etc/pam.d/login:session optional pam_lastlog.so # # Comment this out (insert a '#' at the start of the line). # # This program is free software; you can redistribute it and/or # modify it under the terms of version 2 of the GNU General Public # License as published by the Free Software Foundation. # # 05-Mar-2017 Brendan Gregg Created this. # # Other banner options I was experimenting with: # printf "" # blue background # printf "" # light blue foreground # printf "" # reset colors # echo " **** COMMODORE 64 BASIC V2 ****" # C64 banner # $(cat /proc/$$/comm) --version | awk 'NR == 1 { print " ****", toupper($0), "****"; exit }' # shell version banner # Also "READY" instead of "READY.". # # The blue background / light blue foreground escape codes don't color text # beyond the end of each line. An easier way to get this effect is to set # your terminal color scheme/theme. # # print CPU version: awk '/^model name/ { sub(/^model name[^:]*: /, "", $0); print " ****", toupper($0), "****"; exit }' /proc/cpuinfo # print memory summary: free -b | awk '/^Mem:/ { printf " %dK RAM SYSTEM %d BASIC BYTES FREE\n\nREADY.\n", $2 / 1024, $4 }'