From 821f24402dca69aefdc954f42dcbdfdcef528f76 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Fri, 9 Oct 2009 17:46:23 +0200 Subject: [PATCH] fix bash/sh problem in disk-changer.in --- bacula/scripts/disk-changer.in | 16 +++++++++------- bacula/scripts/mtx-changer.in | 17 ++++++++++++++++- bacula/src/dird/ua_label.c | 7 +++++-- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/bacula/scripts/disk-changer.in b/bacula/scripts/disk-changer.in index f9c800cc0e..3eab743a3e 100644 --- a/bacula/scripts/disk-changer.in +++ b/bacula/scripts/disk-changer.in @@ -280,13 +280,15 @@ case $cmd in # we print drive content seen by autochanger # and we also remove loaded media from the barcode list - for i in $dir/loaded* - do - d=${i##$dir/loaded} - s=$(cat $i) - v=$(awk -F: "/^$s:/"' { print $2 }' $dir/barcodes) - echo "D:$d:F:$s:$v" - echo "^$s:" >> $TMPFILE + i=0 + while [ $i -le $maxdrive ]; do + if [ -f $dir/loaded${i} ]; then + ld=`cat $dir/loaded${i}` + v=`awk -F: "/^$ld:/"' { print $2 }' $dir/barcodes` + echo "D:$i:F:$ld:$$v" + echo "^$ld:" >> $TMPFILE + fi + i=`expr $i + 1` done # Empty slots are not in barcodes file diff --git a/bacula/scripts/mtx-changer.in b/bacula/scripts/mtx-changer.in index 1992e1843d..5c7a5009ff 100644 --- a/bacula/scripts/mtx-changer.in +++ b/bacula/scripts/mtx-changer.in @@ -188,7 +188,22 @@ case $cmd in exit $rtn ;; - listall) + listall) +# Drive content: D:Drive num:F:Slot loaded:Volume Name +# D:0:F:2:vol2 or D:Drive num:E +# D:1:F:42:vol42 +# D:3:E +# +# Slot content: +# S:1:F:vol1 S:Slot num:F:Volume Name +# S:2:E or S:Slot num:E +# S:3:F:vol4 +# +# Import/Export tray slots: +# I:10:F:vol10 I:Slot num:F:Volume Name +# I:11:E or I:Slot num:E +# I:12:F:vol40 + debug "Doing mtx -f $ctl -- to list all" make_temp_file if test ${inventory} -ne 0 ; then diff --git a/bacula/src/dird/ua_label.c b/bacula/src/dird/ua_label.c index 6848c2b55b..0c5a7d0c08 100644 --- a/bacula/src/dird/ua_label.c +++ b/bacula/src/dird/ua_label.c @@ -1062,6 +1062,11 @@ static void content_send_info(UAContext *ua, char type, int Slot, char *vol_name * S:2:E or S:Slot num:E * S:3:F:vol4 * + * Import/Export tray slots: + * I:10:F:vol10 I:Slot num:F:Volume Name + * I:11:E or I:Slot num:E + * I:12:F:vol40 + * * If a drive is loaded, the slot *should* be empty * * Output: @@ -1077,8 +1082,6 @@ static void content_send_info(UAContext *ua, char type, int Slot, char *vol_name * S|2|||||||| * S|3|3|vol4|15869952|Append|LTO1-ANSI|Inc|1250858907|1282394907 * - * Type can be S or I (Slot or Import/Export) - * * TODO: need to merge with status_slots() */ void status_content(UAContext *ua, STORE *store) -- 2.39.5