There are few different approaches for displaying a message to user around the logging screen, /etc/issue (prelogin message and identification file), /etc/motd (message of the day), or the fortune files, and probably more. If you use Graphical Login interface (Display Manager), those will not work for you, your system may go into X window environment before you can even catch a glimpse of issue.
I use Console Display Manager (CDM), the issue file works better for me among those options and I already have it showing “gentoo” in purple text for almost three years since I started using Gentoo.
I wanted to make it more interesting, seeing the same purple text everyday had got me bored. Need to spice it up! Don’t you think? This is what I have now:
Gotta hear something That’s What She Said from TWSS.
The code is not so complicated, basically a one-liner:
cat /etc/issue.logo \
<(echo -e '\e[1;34m') \
<(xmllint --xpath '//item[1]/description/text()' <(wget -q -O - http://www.twssstories.com/rss.xml) |
sed 's/<\/\?p>//g;q' |
fold -s) \
<(echo -e '\e[0m') \
/etc/issue.orig \
> /etc/issue
I use xmllint to extract text of the first description node, remove unwanted escaped HTML tag, wordwrap the text, then produce the file with color code and the purple text.
Generally, I only log in once a day, so I put this script to daily system cron job since I will only see this one-time everyday. Besides, TWSS doesn’t have many entries a day, not even one a day.
Originally, I wasn’t planning using TWSS but xkcd comics. Hoping img2txt of libcaca can magically output good ASCII from image, but that’s just impossible with only 80 characters in width. I am thinking if you have framebuffer, then it might have a chance with rendering of the image.
TWSS is the first source for the text, I am planning to include more sources, randomly pick one, something like quotes or some ASCII-art. As long as websites provide API or RSS feed, I will try to add to my issue file generation script.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.