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

@ -10,6 +10,11 @@ print_specific_help() {
cat << HLP
Specific options:
--dev path Suppress dialog and use path as drive address.
--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 device scanning and list of speeds.
HLP
@ -37,6 +42,7 @@ fi
# Interpret private options, they begin after the first --.
dev=
priv_cmd=
next_is=ignore
for i in "$@"
do
@ -50,9 +56,16 @@ do
then
dev="$i"
next_is=""
elif test "$next_is" = "priv_cmd"
then
priv_cmd="$i"
next_is=""
elif test "$i" = "--dev"
then
next_is="dev"
elif test "$i" = "--priv_cmd"
then
next_is="priv_cmd"
else
echo >&2
echo "Unknown test specific option: $i" >&2
@ -75,8 +88,8 @@ fi
#
get_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" \
echo -e "\n${SELF}: Running: ${priv_cmd} ${RELENG_XORRISO} -report_about WARNING -outdev ${1} -toc -list_formats -list_profiles out -list_speeds"
${priv_cmd} "$RELENG_XORRISO" -report_about WARNING -outdev "$1" \
-print '---toc :' -toc \
-print '---list_formats :' -list_formats \
-print '---list_profiles :' -list_profiles out \
@ -98,7 +111,7 @@ get_devices() {
then
DEVICES="$1"
else
DEVICES=$("$RELENG_XORRISO" $devices_opt 2>/dev/null | grep "\-dev")
DEVICES=$( ${priv_cmd} "$RELENG_XORRISO" $devices_opt 2>/dev/null | grep "\-dev")
fi
NUM_DEV=$(cat_var "$DEVICES" | wc -l)
case "${NUM_DEV}" in
@ -142,7 +155,7 @@ get_devices() {
# main
"$RELENG_XORRISO" -version
echo -e "\n${SELF}: Running: $RELENG_XORRISO $devices_opt ..."
devices=$("$RELENG_XORRISO" -report_about WARNING $devices_opt | grep "\-dev")
devices=$( ${priv_cmd} "$RELENG_XORRISO" -report_about WARNING $devices_opt | grep "\-dev")
RET="$?"
if test "$SIMULATE_FAILURE" = 1
then
@ -165,10 +178,11 @@ case ${RET} in
;;
*)
boldify
echo -ne "\n${SELF}: ${RELENG_XORRISO} $devices_opt returned ${RET}."
echo -ne "\n${SELF}: ${priv_cmd} ${RELENG_XORRISO} $devices_opt returned ${RET}."
unboldify
echo -e "\n${SELF}: Already mounted?"
df -kh
exit 1
esac
exit 0