More fortunes for Mint

If you like to see some funny quotes when opening a new shell terminal, you can enable the fortune-mint script that will be launched automatically.
By default, this script only shows non-offensive quotes and only three different types of animals: the moose, the tux and the koala.
But the cowsay package provides a whole bunch of pictures that can be used.
Cow files in /usr/share/cowsay/cows:
apt beavis.zen bong bud-frogs bunny calvin cheese cock cower daemon default
dragon dragon-and-cow duck elephant elephant-in-snake eyes flaming-sheep
ghostbusters gnu head-in hellokitty kiss kitty koala kosh luke-koala
mech-and-cow meow milk moofasa moose mutilated pony pony-smaller ren sheep
skeleton snowman sodomized-sheep stegosaurus stimpy suse three-eyes turkey
turtle tux unipony unipony-smaller vader vader-koala www

The following patch will enable all these that you have installed in your system, as well as all different eye and tongue styles. If you don't like offensive quotes, you'll have to take off the -a parameter from the fortune command in the last line of the patch below.

Install instructions

Paste the following into a textfile, for example mint-fortune.patch
4c4
<     RANGE=3
---
>     declare -a cows=( $(cowsay -l | grep -v "Cow files in") )
6,17c6,7
<     let "number %= $RANGE"
<     case $number in
<         0)
<             cow="moose"
<             ;;
<         1)
<             cow="tux"
<             ;;
<         2)
<             cow="koala"
<             ;; 
<     esac
---
>     let "number %= ${#cows[*]}"
>     cow=${cows[$number]}
19c9
<     RANGE=2
---
>     declare -a says=( say think )
21,30c11,19
<     let "number %= $RANGE"
<     case $number in
<         0)
<             command="/usr/games/cowsay"
<             ;;
<         1)
<             command="/usr/games/cowthink"
<             ;;
<     esac
<     /usr/games/fortune | $command -f $cow
---
>     let "number %= ${#says[*]}"
>     command="/usr/games/cow${says[$number]}"
> 
>     declare -a states=( "" -b -d -g -p -s -t -w -y )
>     number=$RANDOM
>     let "number %= ${#states[*]}"
>     state=${states[$number]}
> 
>     /usr/games/fortune -a | $command $state -f $cow

Then apply this patch to the original script (a backup will be created) and enable the fortune-teller:
sudo patch -b /usr/bin/mint-fortune mint-fortune.patch
gconftool-2 --set /desktop/linuxmint/terminal/show_fortunes true --type bool

Provide your own cows

You can create your own cow files, just have a look at the manual of the cowsay command. Or just copy the ones I prepared from here into any folder you want.
You could just copy them into the system folder /usr/share/cowsay/cows, but if you want to keep them separated, you can instruct cowsay to look for you ones too (for example in your folder ~/Documents/cows:
mycows=~/Documents/cows ; sudo sed -i.orig 's|/usr/bin/mint-fortune|export COWPATH=/usr/share/cowsay/cows:'$mycows'\n\0|' /etc/bash.bashrc

Example of a Star Wars scene as cow

 _____________
< Hello world >
 -------------
          \
           \                .==.
            \              ()oo()-.
             \  .---.       ;--; /
              .'_:___". _..'.  __'.
              |__ --==|'-''' \'...;
              [  ]  :[|       |---\
              |__| I=[|     .'    '.
              / / ____|     :       '._
             |-/.____.'      | :       :
            /___\ /___\      '-'._----' 

No comments:

Post a Comment