2011-07-11 09:24:57 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2011-07-11 09:40:23 +00:00
|
|
|
# Copyright 2011 George Danchev <danchev@spnet.net>
|
2011-07-11 09:44:01 +00:00
|
|
|
# Licensed under GNU GPL version 2
|
2011-07-11 09:40:23 +00:00
|
|
|
|
2011-07-11 09:24:57 +00:00
|
|
|
# set -e
|
|
|
|
|
|
|
|
# Include common bits
|
|
|
|
. inc/releng_getopts.inc
|
|
|
|
|
|
|
|
# Each releng_ test should decide whether or not it needs
|
|
|
|
# a xorriso binary to test, since some do compilations only.
|
|
|
|
if [ ! -x $RELENG_XORRISO ]; then
|
|
|
|
print_help
|
|
|
|
printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n"
|
|
|
|
exit 31
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
get_speeds() {
|
2011-07-11 18:58:07 +00:00
|
|
|
echo -e "\n${SELF}: Running: ${RELENG_XORRISO} -outdev ${1} -list_speeds"
|
2011-07-11 09:24:57 +00:00
|
|
|
${RELENG_XORRISO} -outdev ${1} -list_speeds
|
2011-07-12 11:01:39 +00:00
|
|
|
RET_SPEEDS="$?"
|
|
|
|
case ${RET_SPEEDS} in
|
|
|
|
0)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
boldify
|
|
|
|
echo -e "\n${SELF}: ${RELENG_XORRISO} -outdev ${1} -list_speeds returned ${RET_SPEEDS}."
|
|
|
|
unboldify
|
|
|
|
;;
|
|
|
|
esac
|
2011-07-11 09:24:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get_devices() {
|
2011-07-11 18:58:07 +00:00
|
|
|
echo -e "\n${SELF}: Running: $RELENG_XORRISO -devices 2>/dev/null | grep \"\-dev\""
|
2011-07-11 09:24:57 +00:00
|
|
|
DEVICES=`$RELENG_XORRISO -devices 2>/dev/null | grep "\-dev"`
|
|
|
|
NUM_DEV=`echo ${DEVICES} | wc -l`
|
|
|
|
|
|
|
|
case "${NUM_DEV}" in
|
|
|
|
0)
|
2011-07-11 18:58:07 +00:00
|
|
|
echo -e "${SELF}: No drives found."
|
2011-07-11 09:24:57 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
1)
|
2011-07-11 18:58:07 +00:00
|
|
|
echo -e "${SELF}: Single drive found:\n${DEVICES}"
|
2011-07-11 09:24:57 +00:00
|
|
|
OUTDEV=`${RELENG_XORRISO} -devices 2>/dev/null | perl -pe "s#^\d+\s+\-dev\s+\'## and s#\'.*##"`
|
|
|
|
get_speeds ${OUTDEV}
|
|
|
|
;;
|
|
|
|
*)
|
2011-07-11 18:58:07 +00:00
|
|
|
echo -e "${SELF}: Multiple drives found. NOT FINISHED YET."
|
2011-07-11 09:26:47 +00:00
|
|
|
exit 2
|
2011-07-11 09:24:57 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
# main
|
|
|
|
echo -e "\n${SELF}: Running: $RELENG_XORRISO -devices..."
|
|
|
|
$RELENG_XORRISO -devices
|
2011-07-12 11:01:39 +00:00
|
|
|
RET_DEVICES="$?"
|
|
|
|
case ${RET_DEVICES} in
|
2011-07-11 09:24:57 +00:00
|
|
|
0)
|
2011-07-12 11:01:39 +00:00
|
|
|
get_devices
|
|
|
|
;;
|
2011-07-11 09:24:57 +00:00
|
|
|
*)
|
2011-07-12 11:01:39 +00:00
|
|
|
boldify
|
|
|
|
echo -ne "\n${SELF}: ${RELENG_XORRISO} -devices returned ${RET_DEVICES}."
|
|
|
|
unboldify
|
|
|
|
echo -e "\n${SELF}: Already mounted?"
|
|
|
|
df -kh
|
|
|
|
;;
|
2011-07-11 09:24:57 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|