Subversion Repositories DevTools

Rev

Rev 4547 | Rev 5810 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4547 Rev 4648
Line 152... Line 152...
152
#echo signature: ${signature}
152
#echo signature: ${signature}
153
#exit 1
153
#exit 1
154
 
154
 
155
# PUT!
155
# PUT!
156
if [ 1 ] ; then
156
if [ 1 ] ; then
-
 
157
[ $verbose -gt 0 ] && echo "Transfer $pkgName/$pkgVer to bucket $bucket"
157
#set -x
158
#set -x
158
tar -czf - -C "$pkgBase" "$pkgName/$pkgVer" |
159
tar -czf - -C "$pkgBase" "$pkgName/$pkgVer" |
159
    curl -s \
160
    curl -s \
160
        -X PUT \
161
        -X PUT \
161
        --data-binary @- \
162
        --data-binary @- \
Line 167... Line 168...
167
        -H "x-amz-acl: ${acl}" \
168
        -H "x-amz-acl: ${acl}" \
168
        -H "x-amz-meta-reason: ${metaData}" \
169
        -H "x-amz-meta-reason: ${metaData}" \
169
        -H "x-amz-storage-class: ${storageType}" \
170
        -H "x-amz-storage-class: ${storageType}" \
170
        "https://${bucket}.s3.amazonaws.com/${file}"
171
        "https://${bucket}.s3.amazonaws.com/${file}"
171
fi
172
fi
-
 
173
[ $verbose -gt 0 ] && echo "Transfer complete"
172
 
174
 
173
#############################################################
175
#############################################################
174
#   Fetch file info, just to be sure that the file got there
176
#   Fetch file info, just to be sure that the file got there
175
#   Get data about the file
177
#   Get data about the file
176
#
178
#
-
 
179
#   Have seen that some files (large) do not appear immediately
-
 
180
#   Solution: Try a few times
-
 
181
#
177
# Calculate the HEAD signature.
182
# Calculate the HEAD signature.
178
#   Note the need for a triple \n
183
#   Note the need for a triple \n
179
#   Is that because there is no contentType ?
184
#   Is that because there is no contentType ?
180
#
185
#
181
stringToSign="HEAD\n\n\n${dateValue}\n${resource}"
186
stringToSign="HEAD\n\n\n${dateValue}\n${resource}"
Line 184... Line 189...
184
    openssl sha1 -hmac "${aws_secret_access_key}" -binary |
189
    openssl sha1 -hmac "${aws_secret_access_key}" -binary |
185
    base64
190
    base64
186
)
191
)
187
 
192
 
188
#set -x
193
#set -x
-
 
194
fileTest=0
-
 
195
for ii in $( seq 1 10 ); do 
-
 
196
    [ $verbose -gt 0 ] && echo "Testing file presence ($ii): ${file}"
189
results=$(curl -I -X HEAD \
197
    results=$(curl -I -X HEAD \
190
        -s \
198
            -s \
191
         --insecure \
199
             --insecure \
192
        -H "Host: ${bucket}.s3.amazonaws.com" \
200
            -H "Host: ${bucket}.s3.amazonaws.com" \
193
        -H "Date: ${dateValue}" \
201
            -H "Date: ${dateValue}" \
194
        -H "Authorization: AWS ${aws_access_key_id}:${signature}" \
202
            -H "Authorization: AWS ${aws_access_key_id}:${signature}" \
195
        "https://${bucket}.s3.amazonaws.com/${file}" \
203
            "https://${bucket}.s3.amazonaws.com/${file}" \
196
        )
204
            )
-
 
205
    if [[ "$results" =~ "HTTP/1.1 200 OK" ]]; then
-
 
206
        fileTest=1
-
 
207
        break
-
 
208
    fi
-
 
209
    echo "Test Fail: ${file}. Attempt: ${ii}"
-
 
210
    [ $verbose -gt 0 ] && echo "Test Failure. Wait and try again"
-
 
211
    sleep 5 
-
 
212
done
197
 
213
 
198
#echo RV: $?
-
 
199
#echo Results: $results
214
# Display results
200
if [[ "$results" =~ "HTTP/1.1 200 OK" ]]; then
215
if [ $fileTest -gt 0 ]; then
201
    if [ $verbose -gt 0 ] ; then
216
    if [ $verbose -gt 0 ] ; then
202
        echo "${ProgName}: Transferred:$pkgName/$pkgVer" 
217
        echo "${ProgName}: Transferred:$pkgName/$pkgVer" 
203
    fi
218
    fi
204
    exit 0
219
    exit 0
205
else
220
else