64 lines
1.5 KiB
Bash
Executable File
64 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright 2011 George Danchev <danchev@spnet.net>
|
|
# Licensed under GNU GPL version 2
|
|
|
|
# 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() {
|
|
echo -e "\n${SELF}: Running: ${RELENG_XORRISO} -outdev ${1} -list_speeds"
|
|
${RELENG_XORRISO} -outdev ${1} -list_speeds
|
|
}
|
|
|
|
get_devices() {
|
|
echo -e "\n${SELF}: Running: $RELENG_XORRISO -devices 2>/dev/null | grep \"\-dev\""
|
|
DEVICES=`$RELENG_XORRISO -devices 2>/dev/null | grep "\-dev"`
|
|
NUM_DEV=`echo ${DEVICES} | wc -l`
|
|
|
|
case "${NUM_DEV}" in
|
|
0)
|
|
echo -e "${SELF}: No drives found."
|
|
exit 1
|
|
;;
|
|
1)
|
|
echo -e "${SELF}: Single drive found:\n${DEVICES}"
|
|
OUTDEV=`${RELENG_XORRISO} -devices 2>/dev/null | perl -pe "s#^\d+\s+\-dev\s+\'## and s#\'.*##"`
|
|
get_speeds ${OUTDEV}
|
|
;;
|
|
*)
|
|
echo -e "${SELF}: Multiple drives found. NOT FINISHED YET."
|
|
exit 2
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# main
|
|
echo -e "\n${SELF}: Running: $RELENG_XORRISO -devices..."
|
|
$RELENG_XORRISO -devices
|
|
RET="$?"
|
|
case ${RET} in
|
|
0)
|
|
get_devices
|
|
;;
|
|
*)
|
|
boldify
|
|
echo -ne "\n${SELF}: ${RELENG_XORRISO} -devices returned ${RET}."
|
|
unboldify
|
|
echo -e "\n${SELF}: Already mounted?"
|
|
df -kh
|
|
esac
|
|
|
|
exit 0
|