]> git.sur5r.net Git - bacula/bacula/commitdiff
fix bash/sh problem in disk-changer.in
authorEric Bollengier <eric@eb.homelinux.org>
Fri, 9 Oct 2009 15:46:23 +0000 (17:46 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Fri, 9 Oct 2009 15:47:18 +0000 (17:47 +0200)
bacula/scripts/disk-changer.in
bacula/scripts/mtx-changer.in
bacula/src/dird/ua_label.c

index f9c800cc0ebb7709b4e41462b571f1abc2407500..3eab743a3ee2e24e53b9d4a873d982927d7d871f 100644 (file)
@@ -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
index 1992e1843d85c0f9d3a9c7908649cf6ea85e3313..5c7a5009ff385dc06d3fdb8735c3ae1428a4b0c5 100644 (file)
@@ -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
index 6848c2b55b43cfc116f74216121df39cb09a61b4..0c5a7d0c088a2acbaf75458dd81e699262cf2707 100644 (file)
@@ -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)