Scott's Super Hip Rip Script
From Taclug
This is the back side of a handout distributed by Chuck Wolber entitled Virtual CD Jukebox at an unknown TACLUG Presentation. It has been manually copied by with minor editing for presentation, clarity, and credits on this wiki. Any errors are probably mine.
#!/bin/sh
# Scott's Super Hip Rip Script - Author: Scott Hunter - TACLUG
#### Before you start ripping CDs, be sure to: ####
# 1) create /mnt/images dir
# 2) create /mnt/iso_srv dir
# 3) add the line "/mnt/iso_srv /etc/auto.iso_srv" to /etc/auto.master
# 4) restart the autofs service (#/etc/rc.d/autofs restart)
# (This is the only time it needs to be restarted)
# 5) give yourself write permissions for:
# /mnt/images and /etc/auto.iso_srv, or run as root
#### After running this script you should: ####
# 1) make a directory /mnt/cdlibrary
# 2) organize your library. Make subdirectories such as:
# windows, linux/distros/SuSe81, applications, etc.
# 3) make descriptive link back to the dir in /mnt/iso_srv:
# ln -s ../../iso_srv/SuSe81-1 SuSe81_Disc1
# 4) set up a Samba share for /mnt/cdlibrary
# Setting variables
IMAGE_PATH=/mnt/images/
ISO_SRV_PATH=/mnt/iso_srv/
AUTO_CONF=/etc/auto.iso_srv
CD_DRIVE=/dev/cdrom
VERIFY="Yes"
# Extract the CD to an ISO image
echo "Please enter the name of the CD (SuSe81-1)"
echo "Keep it simple, no spaces!"
read IMAGE_NAME
IMAGE=$IMAGE_NAME.iso
echo Generating $IMAGE_PATH$IMAGE
echo This may take about 5 minutes
cat $CD_DRIVE > $IMAGE_PATH$IMAGE
if [$? = 0]; then
echo $IMAGE_PATH$IMAGE successfully generated
else
echo Error making ISO image.
echo You may need to try a different disk or drive.
exit 1
fi
echo
# Configure the automounter to load the new image
echo The automounter is now being configured.
MOUNT_OPTIONS="-fstype=iso9660,ro,loop :"
echo $IMAGE_NAME $MOUNT_OPTIONS$IMAGE_PATH$IMAGE >> $AUTO_CONF
echo OK
# verify image integrity and save md5sum with ISO image.
if [ $VERIFY = "Yes"]; then
echo "ISO integrity now being checked"
echo "This will take about 5 minutes"
#Make CD md5sum
md5sum -b $CD_DRIVE > /tmp/CD.md5sum
echo CDROM md5sum complete
CD_SUM='cat /tmp/CD.md5sum | cut -d' -f1
echo "CD_SUM: "$CD_SUM
md5sum -b $IMAGE_PATH$IMAGE > $IMAGE_PATH$IMAGE_NAME.md5sum
echo ISO Image md5sum complete
ISO_SUM='cat $IMAGE_PATH$IMAGE_NAME.md5sum | cut -d' ' -f1
echo ISO_SUM: $ISO_SUM
if [ $CD_SUM = $ISO_SUM ]; then
echo The image has been verified
echo $IMAGE is now installed and ready to use
else
echo The ISO image does not match the CD
echo You need to try again.
fi
else
echo $Image is now installed and ready to be used
fi
--EAWF 02:59, 19 Oct 2005 (PDT)

