Option --priv_cmd for releng/manual_burn and releng/manual_devices

This commit is contained in:
2011-08-11 16:47:51 +00:00
parent 8d971b0537
commit 2043d7ee66
3 changed files with 69 additions and 12 deletions

View File

@ -17,6 +17,11 @@ Specific options:
--any_media allow non re-usable MMC media, like CD-R or DVD+R.
Allow paths to non-existing files, but disallow paths
to existing regular files.
--priv_cmd 'command [arg [arg ...]]'
With drive operations execute xorriso as argument
of the given command (e.g. pfexec, sudo) with the
optionally given arguments: command arg arg xorriso ...
Command and arguments must be single words.
Overview:
Test burning to re-usable media CD-RW, DVD-RW, DVD-RAM, DVD+RW, BD-RE.
By default, one-time usable media will be rejected deliberately.
@ -45,6 +50,7 @@ fi
dev=/dev/cdrw
what=../xorriso
any_media=0
priv_cmd=
# Interpret specific options, they begin after the first --.
next_is=ignore
for i in "$@"
@ -63,6 +69,10 @@ do
then
what="$i"
next_is=""
elif test "$next_is" = "priv_cmd"
then
priv_cmd="$i"
next_is=""
elif test "$i" = "--dev"
then
next_is="dev"
@ -72,6 +82,9 @@ do
elif test "$i" = "--any_media"
then
any_media=1
elif test "$i" = "--priv_cmd"
then
next_is="priv_cmd"
else
echo >&2
echo "Unknown test specific option: $i" >&2
@ -119,13 +132,13 @@ fi
# Inspect media
set +e
res=$("$RELENG_XORRISO" -outdev "$dev" 2>&1)
res=$(${priv_cmd} "$RELENG_XORRISO" -outdev "$dev" 2>&1)
ret=$?
set -e
if test "$ret" -ne 0
then
echo "$res" >&2
echo "FAIL : ${SELF} : Non-zero exit value $ret with: $RELENG_XORRISO -outdev $dev"
echo "FAIL : ${SELF} : Non-zero exit value $ret with: ${priv_cmd} $RELENG_XORRISO -outdev $dev"
echo
cleanup
exit 1
@ -157,9 +170,9 @@ then
fi
# Perform burn run
echo "$RELENG_XORRISO" -for_backup -outdev "$dev" -blank as_needed -map "$what" /test
echo ${priv_cmd} "$RELENG_XORRISO" -for_backup -outdev "$dev" -blank as_needed -map "$what" /test
set +e
"$RELENG_XORRISO" \
${priv_cmd} "$RELENG_XORRISO" \
-for_backup \
-outdev "$dev" \
-blank as_needed \
@ -189,10 +202,10 @@ then
fi
# Check read
echo "$RELENG_XORRISO" -for_backup -indev "$dev" \
echo ${priv_cmd} "$RELENG_XORRISO" -for_backup -indev "$dev" \
-check_media event=FATAL -- \ -check_md5_r FATAL / --
set +e
"$RELENG_XORRISO" \
${priv_cmd} "$RELENG_XORRISO" \
-for_backup \
-indev "$dev" \
-print '---check_media:' -check_media event=FATAL -- \