Toilet Fun
It’s been a slow Friday afternoon at the office, so I decided to pimp my VM. The tool of choice is “toilet“. Depending on your flavor, this may or may not be easy to install. Try the usual pkg-get or yum and see what happens. I was installing on RHEL 6.3 64-bit and -with EPEL and everything – yum did not find “toilet”, so I had to build from source and that’s what we’ll cover here.
Toilet’s “configure” script has a couple of logic holes you will need to get around. First things first, get the sources for libcaca and toilet and install libcaca. Don’t try to install libcaca with yum, as the repo version is likely to be too old to work with toilet.
i=libcaca-0.99.beta19 j=toilet-0.3 cd /tmp wget -O ${i}.tar.gz http://caca.zoy.org/files/libcaca/${i}.tar.gz wget -O ${j}.tar.gz http://caca.zoy.org/raw-attachment/wiki/toilet/${j}.tar.gz tar zxvf /tmp/${i}.tar.gz tar xxvf /tmp/${j}.tar.gz cd /tmp/$i ./configure make make install
The next step is to compile toilet, and here you may run into an issue of the “configure” script not being able to find libcaca libraries. Here’s a quick fix, maybe:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config --modversion caca ln -s /usr/local/lib/libcaca.so.0 /usr/lib64/libcaca.so.0
Now go ahead and try to compile toilet:
j=toilet-0.3 cd /tmp/$j ./configure make make install toilet -v
Toilet uses figlet fonts. This should be easy to install with yum or what not. You may need to enable the EPEL repo for REHL/CentOS.
yum -y install figlet
Now the part: let’s take a look at what toilet output looks like with the available fonts. The following command will look for installed fonts in the usual places and run toilet using those fonts.
for i in /usr/local/share/figlet /usr/share/figlet ; do find $i -name "*\.[ft]lf" | sort -u | awk -F'/' '{print $NF}' | awk -F'.' '{print $1}' | while read font ; do echo $font ; toilet -t -W -d $i --metal -f $font "$font" ; done ; done
As a simple practical exercise, you can add toilet to your ~/.bashrc
if [ -t 0 ] ; then toilet -d /usr/local/share/figlet -t -W -f pagga --metal `hostname -s` cat << EOF | toilet -d /usr/local/share/figlet -t -W -f wideterm --metal `date +'%A, %B %d'` EOF fi
The “if [ -t 0 ]” part is designed to test for TTY so not to break scp functionality and such. The end result:
You can even add some text animation with “pv” (yum -y install pv):
if [ -t 0 ] ; then toilet -d /usr/local/share/figlet -t -W -f pagga --metal `hostname -s` cat << EOF | toilet -d /usr/local/share/figlet -t -W -f wideterm --metal | pv -qL 100 `date +'%A, %B %d'` EOF fi
That was worth my time…