Home | History | Annotate | Download | only in build_scripts
      1 #!/bin/bash
      2 
      3 # Looks for CD/DVD drives and then determine
      4 # if there is at least ONE disc in the system's CDROM drives.
      5 
      6 # Copyright (C) 2003-2006 IBM
      7 #
      8 # This program is free software; you can redistribute it and/or
      9 # modify it under the terms of the GNU General Public License as
     10 # published by the Free Software Foundation; either version 2 of the
     11 # License, or (at your option) any later version.
     12 #
     13 # This program is distributed in the hope that it will be useful, but
     14 # WITHOUT ANY WARRANTY; without even the implied warranty of
     15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16 # General Public License for more details.
     17 #
     18 # You should have received a copy of the GNU General Public License
     19 # along with this program; if not, write to the Free Software
     20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
     21 # 02111-1307, USA.
     22 
     23 . "$POUNDER_SRCDIR/libidecd.sh"
     24 
     25 DRIVES_FOUND=`find_discs_with_media`
     26 if [ "$DRIVES_FOUND" == "NONE 0" ]; then
     27         echo "[ide_cdrom_copy] No CD/DVD drives found. CD test will not build."
     28         exit 1;
     29 fi
     30 
     31 DEFAULT_MOUNT="$POUNDER_TMPDIR/cdmount"
     32 
     33 # Ensure that our default mountpoint and destination dirs exist.
     34 mkdir -p "$DEFAULT_MOUNT"
     35 
     36 # How many discs can we find?
     37 DISCS_FOUND=`find_discs_with_media | wc -l`
     38 if [ $DISCS_FOUND -lt 1 ]; then
     39         echo -en "Examined "
     40         find_disc_devices | while read f; do
     41                 echo -en "$f "
     42                 eject "$f"
     43         done
     44         echo " and found no discs to test."
     45         echo "Please put a disc into the CD/DVD drive(s) and press ENTER."
     46         read garbage
     47 
     48         DISCS_FOUND=`find_discs_with_media | wc -l`
     49         if [ $DISCS_FOUND -lt 1 ]; then
     50                 echo "Still can't find any discs.  CD test will probably not run."
     51                 exit 0
     52         fi
     53 fi
     54 
     55 exit 0
     56 
     57