#!/bin/sh
#
# $Id: hack-cfg-if-necessary 1983 2008-06-16 19:40:42Z bruno $
#

if ! mount | grep cdrom ; then 
    LogIt "CD-ROM is not mounted. Darn."
    exit 0
fi

if ! ls /mnt/cdrom/archives/* > /dev/null 2> /dev/null ; then
    LogIt "Can't find /mnt/cdrom/archives; darn."
    exit 0
fi

LogIt "OK, we've found /mnt/cdrom/archives/*; great."

if ! grep "backup-media-type iso" /tmp/mondo-restore.cfg 2 > /dev/null ; then
    LogIt "Config file is fine, BTW."
    exit 0
fi

LogIt "Re-jigging mondo-restore.cfg because you backed up to ISOs and then burned them to CDs" 1
sed -i 's/backup-media-type iso/backup-media-type cdr/' /tmp/mondo-restore.cfg
LogIt "Done re-jigging. Yay."
exit 0
