From a481f41d1c47a0469ccb3218f49f42b431663ace Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 13 Jul 2011 19:05:06 +0000 Subject: [PATCH] Proposal for test ./manual_devices --- releng/manual_devices_ts | 59 ++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/releng/manual_devices_ts b/releng/manual_devices_ts index 543bbfd7..406ae5a0 100755 --- a/releng/manual_devices_ts +++ b/releng/manual_devices_ts @@ -19,8 +19,28 @@ else exit 2 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 -if [ ! -x $RELENG_XORRISO ]; then +if [ ! -x "$RELENG_XORRISO" ]; then print_help printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n" exit 31 @@ -28,8 +48,12 @@ fi # get_speeds() { - echo -e "\n${SELF}: Running: ${RELENG_XORRISO} -outdev ${1} -list_speeds" - ${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" -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() { @@ -40,7 +64,8 @@ $1 } 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" then @@ -64,17 +89,21 @@ get_devices() { echo ================================================================= echo "$DEVICES" echo ================================================================= - + OUTDEV=$( cat_var "$DEVICES" | head -1 | \ sed -e "s/[0-9] *-dev '\//\//" -e "s/'.*$//" ) - - echo >&2 - echo "WARNING: The following tests might pull in the drive tray." >&2 - echo " Best is if you now put in a suitable media and load it" >&2 - echo " manually, so nobody gets surprised. :))" >&2 - echo >&2 - echo "Which drive to examine ? (Empty input = ${OUTDEV})" >&2 - read x + if test -n "$2" + then + x="$2" + else + echo >&2 + echo "WARNING: The following tests might pull in the drive tray." >&2 + echo " Best is if you now put in a suitable media and" >&2 + 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" then OUTDEV="$x" @@ -86,11 +115,11 @@ get_devices() { # main "$RELENG_XORRISO" -version 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="$?" case ${RET} in 0) - get_devices "$devices" + get_devices "$devices" "$dev" ;; *) boldify