TITLE:			Fortune Mod 9708
LFS VERSION:		Tested on 3.3, should work with any
AUTHOR:			Jack Saunders <jack@jackonline.co.uk>

SYNOPSIS:
	Explains how to install Fortune Mod 9708 and how to make a
	bootscript to set /etc/motd using fortune.

HINT:
Download fortune-mod-9708.tar.gz from
http://www.ibiblio.org/pub/Linux/games/amusements/fortune/ (or any mirror).
Unpack the file with:
tar zxvf fortune-mod-9708.tar.gz && cd fortune-mod-9708

At this point you have two decisions to make.
The first is whether or not you want to install the utils that come with 
fortune. These are not required and you probably won't want to use them.
Secondly, you need to decide whether or not you want to install the offensive
quotes. Offensive counts as: (taken from "Offensive" file)
	Anything about sex is offensive.  Welcome to America.  *sigh*
        Insults based on religion or ethnicity are offensive.
	Generally, any criticism of anybody's religion is offensive.
	"He really said that?" quotes from politicians are offensive.
	Political bias is offensive.
	Limericks are offensive even if they aren't.
	Tastelessness is offensive (q.v. "The Snack").
	Misogyny and misandry for the sake of themselves are offensive.
	Vulgarity is offensive.
        Violence for the sake of humor is offensive.
It is entirely up to you if you install the offensive quotes or not. I choose
not to, because I run a multiuser, family system.

If you choose not to install the offensive quotes use this to compile the
package:
make &&
make OFFENSIVE=0 install-cookie &&
make FORTDIR="/usr/bin" install-fortune &&
make install-fman

(if you want the utils as well change the above to:
make &&
make OFFENSIVE=0 install-cookie &&
make FORTDIR="/usr/bin" install
)

If you choose to install the offensive quotes use this:
make &&
make OFFENSIVE=1 install-cookie &&
make FORTDIR="/usr/bin" install-fortune &&
make install-fman

(if you want the utils as well change the above to:
make &&
make OFFENSIVE=1 install-cookie &&
make FORTDIR="/usr/bin" install
)

We install into /usr/bin instead of the default /usr/local/games because
1) this directory does not exist in a standard LFS system
2) you would have to add /usr/local/games to your PATH

I assume /usr/local/games is the FHS compliant place to install fortune, if
you want to install into /usr/local/games simply change  FORTDIR="/usr/bin" 
to  FORTDIR="/usr/local/games".

Test the fortune installation with the command "fortune". You should see a
funny (well, hopefully funny ;-)) quote. If you do not check your PATH and 
check the install went correctly.


/etc/motd is shown every time a user logs in. If you want this to be set by
fortune follow the instructions below. If not then you're done!

First of all make the bootscript. This is a little hack/edit of the one used
in the linux logo hint, thanks to the author of that hint.

cat > /etc/rc.d/init.d/motd << "EOF"
#!/bin/bash
# Begin $rc_base/init.d/motd

source /etc/sysconfig/rc
source $rc_functions

case "$1" in
        start|stop)
                echo "Setting motd (fortune)"
                fortune >/etc/motd 2>&1
	        evaluate_retval
	        ;;
        *)
		echo "Usage: $0 {start}"
	 	exit 1
		;;
esac

# End $rc_base/init.d/motd
EOF
chmod 755 /etc/rc.d/init.d/motd

Then make a link in the appropriate run levels:
ln /etc/rc.d/init.d/motd /etc/rc.d/rc3.d/S36motd -s &&
ln /etc/rc.d/init.d/motd /etc/rc.d/rc4.d/S36motd -s &&
ln /etc/rc.d/init.d/motd /etc/rc.d/rc5.d/S36motd -s

(I've chosen S36 simply because it came one after the /etc/issue script. If
this causes any conflicts or you have a better number for it, please email me
.)
We put it in rc5, so that if a user changes to a console, or telnets in the 
message will still be seen.

Finally reboot the system, log in and you should see a nice message of the
day.

Feel free to send a questions/comments to me.
