Proposal for test ./manual_devices

This commit is contained in:
Thomas Schmitt 2011-07-13 19:05:06 +00:00
parent b5a93f2de7
commit a481f41d1c

View File

@ -19,8 +19,28 @@ else
exit 2 exit 2
fi fi
# Interpret private options
dev=
next_is=
echo >&2
echo "args= ""$@" >&2
echo >&2
for i in "$@"
do
if test "$next_is" = "dev"
then
dev="$i"
next_is=""
elif test "$i" = "--outdev" -o "$i" = "--dev"
then
next_is="dev"
fi
done
# Insist in having a xorriso # Insist in having a xorriso
if [ ! -x $RELENG_XORRISO ]; then if [ ! -x "$RELENG_XORRISO" ]; then
print_help print_help
printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n" printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n"
exit 31 exit 31
@ -28,8 +48,12 @@ fi
# #
get_speeds() { get_speeds() {
echo -e "\n${SELF}: Running: ${RELENG_XORRISO} -outdev ${1} -list_speeds" echo -e "\n${SELF}: Running: ${RELENG_XORRISO} -report_about WARNING -outdev ${1} -toc -list_formats -list_profiles out -list_speeds"
${RELENG_XORRISO} -outdev ${1} -list_speeds "$RELENG_XORRISO" -report_about WARNING -outdev "$1" \
-print '---toc :' -toc \
-print '---list_formats :' -list_formats \
-print '---list_profiles :' -list_profiles out \
-print '---list_speeds :' -list_speeds
} }
cat_var() { cat_var() {
@ -40,7 +64,8 @@ $1
} }
get_devices() { get_devices() {
# $1 = # $1 = if not empty: device lines from xorriso -devices
# $2 = if not empty: suppress dialog and use $2 as input
if test -n "$1" if test -n "$1"
then then
@ -64,17 +89,21 @@ get_devices() {
echo ================================================================= echo =================================================================
echo "$DEVICES" echo "$DEVICES"
echo ================================================================= echo =================================================================
OUTDEV=$( cat_var "$DEVICES" | head -1 | \ OUTDEV=$( cat_var "$DEVICES" | head -1 | \
sed -e "s/[0-9] *-dev '\//\//" -e "s/'.*$//" ) sed -e "s/[0-9] *-dev '\//\//" -e "s/'.*$//" )
if test -n "$2"
echo >&2 then
echo "WARNING: The following tests might pull in the drive tray." >&2 x="$2"
echo " Best is if you now put in a suitable media and load it" >&2 else
echo " manually, so nobody gets surprised. :))" >&2 echo >&2
echo >&2 echo "WARNING: The following tests might pull in the drive tray." >&2
echo "Which drive to examine ? (Empty input = ${OUTDEV})" >&2 echo " Best is if you now put in a suitable media and" >&2
read x echo " load it manually, so nobody gets surprised. :))" >&2
echo >&2
echo "Which drive to examine ? (Empty input = ${OUTDEV})" >&2
read x
fi
if test -n "$x" if test -n "$x"
then then
OUTDEV="$x" OUTDEV="$x"
@ -86,11 +115,11 @@ get_devices() {
# main # main
"$RELENG_XORRISO" -version "$RELENG_XORRISO" -version
echo -e "\n${SELF}: Running: $RELENG_XORRISO -devices..." echo -e "\n${SELF}: Running: $RELENG_XORRISO -devices..."
devices=$("$RELENG_XORRISO" -devices 2>/dev/null | grep "\-dev") devices=$("$RELENG_XORRISO" -report_about WARNING -devices | grep "\-dev")
RET="$?" RET="$?"
case ${RET} in case ${RET} in
0) 0)
get_devices "$devices" get_devices "$devices" "$dev"
;; ;;
*) *)
boldify boldify