punkwalrus (punkwalrus) wrote,

Installing wide fonts for MOTD in Debian

This made me so mad. Apparently, since Debian Etch, the login banner "Message of the day" is re-written after reboot. Well, that sucks. The issue is, I created some nice MOTD banners for a bunch of Debian system, but upon reboot, they had the annoying default uname -a and copyright info from the install. I was so annoyed. I generated fonts, made them look nice and professional... pooh. So I decided to do some research, and nail down the MOTD for my systems. I was even going to see if I could generate "giant text" on the fly.

There are several ways to go about fixing this. The first is to know that the MOTD is created upon bootup with /etc/init.d/bootmisc.sh. If you look at that line:
# Update motd
uname -snrvm > /var/run/motd
[ -f /etc/motd.tail ] && cat /etc/motd.tail >> /var/run/motd

The file /etc/motd is a symlink to /var/run/motd. So you have a few choices:

  1. Comment out that portion in /etc/init.d/bootmisc.sh
  2. Change /etc/motd.tail (if you don't mind the uname info up top, or change that in bootmisc.sh)
  3. Link /etc/motd to something else. Like /etc/motd.static
  4. Make your own script that changes the MOTD in rc.local, via a cron job, etc...

I kind of like the old UNIX style of doing MOTD back at the University of Maryland. Our MOTD really was a "message of the day," and changed when we had something new to say to people logging in (which was about every day, sometimes twice a day). A few years ago, I worked with a company that modified Red Hat 9 to do some nifty "professional touches," to their systems, and one of them I liked was automatically having BIG FONTS in their MOTD. By that I mean, when you renamed a system, like to "SYSTEM54.SRV," when you logged in, the banner would say, automatically:
 ______   ______ _____ _____ __  __ ____  _  _    ____  ______     __
/ ___\ \ / / ___|_   _| ____|  \/  | ___|| || |  / ___||  _ \ \   / /
\___ \\ V /\___ \ | | |  _| | |\/| |___ \| || |_ \___ \| |_) \ \ / / 
 ___) || |  ___) || | | |___| |  | |___) |__   _| ___) |  _ < \ V /  
|____/ |_| |____/ |_| |_____|_|  |_|____/   |_|(_)____/|_| \_\ \_/   
Greetings fellow Star Gazers!
System last booted:         system boot  2009-03-29 09:58

How did they do that? That's when I learned (today) about figlet. It's not in the main free repositories, so you'll have to add:
    deb http://ftp.us.debian.org/debian lenny main non-free

to your sources.list and run an apt-get update (assuming you have Lenny, replace Etch or Intrepid or whatever if you're not on vanilla Debian 5.0). Then do apt-get install figlet. Do a man figlet to get all the options, but the base font was fine for me.
figlet SYSTEM54.SRV && printf '\nGreetings fellow Star Gazers!\n' && 
printf "System last booted:" && who -b

gave me the output above.

Pretty cool, huh? There's all kinds of info you can slap in there. Keep in mind, the MOTD is not a dynamic file, you have to manually change it somehow. If you want neat stuff like "you last logged in," or some random fortune, that's done in the .bash_login file (for bash).
Tags: debian, figlet, linux, motd
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded