#!/bin/sh
# vim: set sw=4 ts=4 si et: 
# Written by Guido Socher
# For this to work you need the entry
# /dev/cdrom     /cdrom         iso9660 noauto,ro,user,exec  0 0
# in /etc/fstab
# You need to have the link /dev/cdrom to the right device 
# e.g /dev/hdc and you need to have a world writable (chmod 777) 
# directory called /cdrom unless your mount command runs with SUID.
# mount with SUID seems to be the default for most recent Linux systems.
#
# 
if [ ! -d "/cdrom" ]; then 
    echo "ERROR: no such directory /cdrom"
    exit 2
fi
msuccess()
{
    echo "CD mounted at /cdrom"
    exit 0
}
# reduce the cdrom speed:
cdspeed -s 8
/bin/mount /cdrom && msuccess
# It was an error if we got here:
echo "ERROR: mounting of /cdrom failed"
exit 1
