#!/usr/bin/env bash

#Apply changes	

# Make sure BashBurn knows it is configured.
BBISCONF="1"

BBTEMPFILE=$(tempfile -s .bb 2> /dev/null) || \
    BBTEMPFILE=$(mktemp -q -t bb.XXXXXX 2> /dev/null) || \
    { touch /tmp/bbtempfile; BBTEMPFILE="/tmp/bbtempfile"; }
sed -e "s°^BBCDWRITER.*°BBCDWRITER: $BBCDWRITER°"	\
    -e "s°^BBCDROM.*°BBCDROM: $BBCDROM°"	\
    -e "s°^BBCDMNT.*°BBCDMNT: $BBCDMNT°"	\
    -e "s°^BBSPEED.*°BBSPEED: $BBSPEED°"	\
    -e "s°^BBBLANKING.*°BBBLANKING: $BBBLANKING°"	\
    -e "s°^BBNUMDEV.*°BBNUMDEV: $BBNUMDEV°"	\
    -e "s°^BBROOTDIR.*°BBROOTDIR: $BBROOTDIR°"	\
    -e "s°^BBBURNDIR.*°BBBURNDIR: $BBBURNDIR°"	\
    -e "s°^BBLABEL.*°BBLABEL: $BBLABEL°"	\
    -e "s°^BBCOPYRIGHT.*°BBCOPYRIGHT: $BBCOPYRIGHT°"	\
    -e "s°^BBDESCRIPTION.*°BBDESCRIPTION: $BBDESCRIPTION°"	\
    -e "s°^BBAUTHOR.*°BBAUTHOR: $BBAUTHOR°"	\
    -e "s°^BBPUBLISHER.*°BBPUBLISHER: $BBPUBLISHER°"	\
    -e "s°^BBNAMEOFPACKAGE.*°BBNAMEOFPACKAGE: $BBNAMEOFPACKAGE°"	\
    -e "s°^BBNORMALIZE.*°BBNORMALIZE: $BBNORMALIZE°"	\
    -e "s°^BBOPT_ONE.*°BBOPT_ONE: $BBOPT_ONE°"	\
    -e "s°^BBFIFODIR.*°BBFIFODIR: $BBFIFODIR°"	\
    -e "s°^BBDELTEMPBURN.*°BBDELTEMPBURN: $BBDELTEMPBURN°"	\
    -e "s°^BBOVERBURN.*°BBOVERBURN: $BBOVERBURN°"	\
    -e "s°^BBCOPY_PROTECT.*°BBCOPY_PROTECT: $BBCOPY_PROTECT°"	\
    -e "s°^BBBITRATE.*°BBBITRATE: $BBBITRATE°"	\
    -e "s°^BBLANG.*°BBLANG: $BBLANG°"	\
    -e "s°^BBISCONF.*°BBISCONF: $BBISCONF°"	\
    -e "s°^BBDTAO.*°BBDTAO: $BBDTAO°"	\
    -e "s°^BBPADDING.*°BBPADDING: $BBPADDING°" $BBCONFFILE > ${BBTEMPFILE}

if [ "$BBCONFFILE" = "$BBCONFFILEDEF" ]; then 
	export BBCONFFILE="$HOMEDIR/.bashburnrc"
fi

cat ${BBTEMPFILE} > $BBCONFFILE
rm ${BBTEMPFILE}

