#! /bin/sh

PREREQ=""
DESCRIPTION="Adding APT-CDROM source..."

prereqs()
{
       echo "$PREREQ"
}

case $1 in
# get pre-requisites
prereqs)
       prereqs
       exit 0
       ;;
esac

. /scripts/casper-functions

log_begin_msg "$DESCRIPTION"

# apt-cdrom would fail otherwise
if [ ! -s /root/cdrom/.disk/info ]; then
    exit 0
fi

mount -n -o bind /sys /root/sys
mount -n -o bind /proc /root/proc
mount -n -o bind /dev /root/dev
chroot /root apt-cdrom -o Acquire::cdrom::mount=/cdrom \
		       -o Dir::Media::MountPath=/cdrom \
		       -o Acquire::cdrom::AutoDetect=false -m add
umount /root/dev
umount /root/proc
umount /root/sys

log_end_msg
