]>
Commit | Line | Data |
---|---|---|
0adfa9dc JR |
1 | diff -urN amanda-2.4.2p2/changer-src/chg-zd-mtx.sh.in amanda-2.4.2p2.new/changer-src/chg-zd-mtx.sh.in |
2 | --- amanda-2.4.2p2/changer-src/chg-zd-mtx.sh.in Tue Apr 3 02:43:07 2001 | |
3 | +++ amanda-2.4.2p2.new/changer-src/chg-zd-mtx.sh.in Tue Mar 19 20:06:46 2002 | |
4 | @@ -158,8 +158,8 @@ | |
5 | eject() { | |
6 | readstatus | |
7 | echo "EJECT -> ejecting tape from $tape to slot $usedslot" >> $DBGFILE | |
8 | - if [ $usedslot -gt 0 ]; then | |
9 | - if [ $OFFLINE_BEFORE_UNLOAD -gt 0 ]; then | |
10 | + if [ "$usedslot" -gt 0 ]; then | |
11 | + if [ "$OFFLINE_BEFORE_UNLOAD" -gt 0 ]; then | |
12 | $MT $MTF $tape offline | |
13 | fi | |
14 | $MTX unload $usedslot $drivenum 2>/dev/null | |
15 | @@ -192,7 +192,7 @@ | |
16 | echo "LOADSLOT -> load tape from slot $whichslot" >> $DBGFILE | |
17 | case $whichslot in | |
18 | current) | |
19 | - if [ $usedslot -lt 0 ]; then | |
20 | + if [ "$usedslot" -lt 0 ]; then | |
21 | loadslot=$firstslot | |
22 | else | |
23 | echo "$usedslot $tape" | |
24 | @@ -200,18 +200,18 @@ | |
25 | fi | |
26 | ;; | |
27 | next|advance) | |
28 | - if [ $usedslot -lt 0 ]; then | |
29 | + if [ "$usedslot" -lt 0 ]; then | |
30 | loadslot=$firstslot | |
31 | else | |
32 | loadslot=`expr $usedslot + 1` | |
33 | - if [ $loadslot -gt $lastslot ]; then | |
34 | + if [ "$loadslot" -gt "$lastslot" ]; then | |
35 | loadslot=$firstslot | |
36 | fi | |
37 | fi | |
38 | ;; | |
39 | prev) | |
40 | loadslot=`expr $usedslot - 1` | |
41 | - if [ $loadslot -lt $firstslot ]; then | |
42 | + if [ "$loadslot" -lt "$firstslot" ]; then | |
43 | loadslot=$lastslot | |
44 | fi | |
45 | ;; | |
46 | @@ -222,7 +222,7 @@ | |
47 | loadslot=$lastslot | |
48 | ;; | |
49 | $numeric) | |
50 | - if [ $whichslot -gt $lastslot ] || [ $whichslot -lt $firstslot ]; then | |
51 | + if [ "$whichslot" -gt "$lastslot" ] || [ "$whichslot" -lt "$firstslot" ]; then | |
52 | echo "0 Slot $whichslot is out of range ($firstslot - $lastslot)" | |
53 | exit 1 | |
54 | else | |
55 | @@ -239,18 +239,18 @@ | |
56 | esac | |
57 | ||
58 | # Is this already the current slot? | |
59 | - if [ $loadslot = $usedslot ]; then | |
60 | + if [ "$loadslo"t = "$usedslot" ]; then | |
61 | echo "$usedslot $tape" | |
62 | exit 0 | |
63 | fi | |
64 | ||
65 | # Is this a cleaning request? | |
66 | - if [ $loadslot = $cleanslot ]; then | |
67 | + if [ "$loadslot" = "$cleanslot" ]; then | |
68 | expr $cleancount + 1 > $cleanfile | |
69 | echo 0 > $accessfile | |
70 | else | |
71 | expr $accesscount + 1 > $accessfile | |
72 | - if [ $AUTOCLEAN -gt 0 -a $accesscount -gt $autocleancount ]; then | |
73 | + if [ "$AUTOCLEAN" -gt 0 -a "$accesscount" -gt "$autocleancount" ]; then | |
74 | $myname -slot clean >/dev/null | |
75 | ||
76 | # Slot $cleanslot might contain an ordinary tape rather than a cleaning | |
77 | @@ -261,9 +261,9 @@ | |
78 | fi | |
79 | ||
80 | # Unload any previous tape | |
81 | - if [ $usedslot -ne "-1" ]; then | |
82 | + if [ "$usedslot" -ne "-1" ]; then | |
83 | echo " -> unload $usedslot from $tape" >> $DBGFILE | |
84 | - if [ $OFFLINE_BEFORE_UNLOAD -gt 0 ]; then | |
85 | + if [ "$OFFLINE_BEFORE_UNLOAD" -gt 0 ]; then | |
86 | $MT $MTF $tape offline | |
87 | fi | |
88 | result=`$MTX unload $usedslot $drivenum 2>&1` | |
89 | @@ -282,7 +282,7 @@ | |
90 | echo " -> status $status, result '$result'" >> $DBGFILE | |
91 | ||
92 | # If there is an error, abort unless the slot is simply empty | |
93 | - if [ $status -ne 0 ]; then | |
94 | + if [ "$status" -ne 0 ]; then | |
95 | empty=`echo $result | grep "Empty"` | |
96 | if [ -z "$empty" ]; then | |
97 | echo "$loadslot $result" | |
98 | @@ -299,7 +299,7 @@ | |
99 | #### Don't assume the drive is ready until we get an ONLINE | |
100 | #### This is tested by the variable $offlinestatus from the beginning. | |
101 | ||
102 | - if [ $offlinestatus -eq 0 ]; then | |
103 | + if [ "$offlinestatus" -eq 0 ]; then | |
104 | readyError="offline" | |
105 | while [ -n "$readyError" ]; do | |
106 | readyStatus=`$MT $MTF $tape status 2>&1` | |
107 | @@ -330,8 +330,8 @@ | |
108 | echo "INFO -> current slot $usedslot, last slot $lastslot, can go backwards 1" >> $DBGFILE | |
109 | #### Checks if you have a barcode reader or not. If so, it passes the 4th item in the echo | |
110 | #### back to amtape signifying it can search based on barcodes. | |
111 | - if [ $havereader -eq 1 ]; then | |
112 | - if [ $usedslot -lt 0 ]; then | |
113 | + if [ "$havereader" -eq 1 ]; then | |
114 | + if [ "$usedslot" -lt 0 ]; then | |
115 | #### added a variable to the end of the following 2 echos. | |
116 | #### This indicates to amtape that it can/cannot read barcodes. | |
117 | echo "0 $lastslot 1 1" | |
118 | @@ -340,7 +340,7 @@ | |
119 | fi | |
120 | exit 0 | |
121 | else | |
122 | - if [ $usedslot -lt 0 ]; then | |
123 | + if [ "$usedslot" -lt 0 ]; then | |
124 | echo "0 $lastslot 1" | |
125 | else | |
126 | echo "$usedslot $lastslot 1" | |
127 | @@ -360,17 +360,17 @@ | |
128 | case $tapelabel in | |
129 | $tapelabel) | |
130 | echo "LABEL -> Adding Barcode $barcode and amlabel $tapelabel for Slot $usedslot into $labelfile" >> $DBGFILE | |
131 | - if [ $labelfilesize -eq 2 ]; then | |
132 | + if [ "$labelfilesize" -eq 2 ]; then | |
133 | echo "$tapelabel $barcode" > $labelfile | |
134 | echo "0 $usedslot $tape" | |
135 | else | |
136 | included=`grep $tapelabel $labelfile | awk '{print $1}'` | |
137 | - if [ -z $included ]; then | |
138 | + if [ -z "$included" ]; then | |
139 | echo "$tapelabel $barcode" >> $labelfile | |
140 | echo "0 $usedslot $tape" | |
141 | else | |
142 | oldbarcode=`grep $tapelabel $labelfile | awk '{print $2}'` | |
143 | - if [ $oldbarcode -eq $barcode ]; then | |
144 | + if [ "$oldbarcode" -eq "$barcode" ]; then | |
145 | echo " -> Barcode $barcode $oldbarcode already synced for $tapelabel" >> $DBGFILE | |
146 | echo "0 $usedslot $tape" | |
147 | ||
148 | @@ -403,7 +403,7 @@ | |
149 | includedslot=`echo $tmpincludedslot | sed -n "s/\(.*\)Storage Element \([1-9][0-9]*\):\(.*\)/\2/p;s/Data Transfer Element $drivenum:Full (Storage Element \([1-9][0-9]*\) Loaded)\(.*\)/\1/p"` | |
150 | case $tapelabel in | |
151 | $tapelabel) | |
152 | - if [ $tapelabel == $includedtag ]; then | |
153 | + if [ "$tapelabel" == "$includedtag" ]; then | |
154 | shift | |
155 | loadslot $includedslot | |
156 | echo "$tape" |