#!/bin/sh
echo "another run of git bisect"
# MUST be outside libcdio directory
# not sufficient to use nicer git clean -fXd
git clean -fxd
if [ $? -ne 0 ]
then
    echo "FAILED git clean"
    exit 1
fi
# FOR THIS BISECT WE INCORPORATE c8d044e
sed -i -e 's/enable_rock=no/enable_rock=yes/' configure.ac
sh ./autogen.sh
if [ $? -ne 0 ]
then
    echo "FAILED autogen.sh"
    git checkout -f
    exit 125
fi
./configure --disable-shared CFLAGS='-fno-inline -g'
if [ $? -ne 0 ]
then
    echo "FAILED configure"
    git checkout -f
    exit 125
fi
touch doc/version.texi src/cd-drive.1 src/cd-info.1 src/cd-read.1 src/iso-read.1 src/iso-info.1
if [ $? -ne 0 ]
then
    echo "FAILED touch"
    exit 125
fi
make clean
if [ $? -ne 0 ]
then
    echo "FAILED make clean"
    git checkout -f
    exit 125
fi
make
if [ $? -ne 0 ]
then
    echo "FAILED make"
    git checkout -f
    exit 125
fi
# fix this path to wherever you put that .iso file
# THIS IS ABOUT WRONG firewire-core-modules-3.8.0-29-generic-di_3.8.0-29.42~precise.ude
# VERSUS RIGHT firewire-core-modules-3.8.0-29-generic-di_3.8.0-29.42~precise1_i386.udeb
src/iso-info -i ~/Downloads/ubuntu-12.04.3-alternate-i386.iso -f | grep 'firewire.*~precise1_i386'
success=$?
if [ $success -ne 0 ]
then
    echo "FAILED iso-read-test.sh"
fi
git checkout -f
if [ $? -ne 0 ]
then
    echo "FAILED git checkout -f"
    exit 255
fi
exit $success
