Created
August 12, 2020 16:03
-
-
Save amit-gshe/06b665a1ddd8cc940206db58774f4da8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
AccessKeyId=test | |
Secret=test | |
file_array=() | |
for dir in $*; do | |
for file in `find $dir -type f`; do | |
# echo $file | |
file_array+=(h5devcdn.cc.lerjin.com/$file) | |
done | |
done | |
files_param=$( IFS='|' ; echo "${file_array[*]}" ) | |
ObjectPath="${files_param//|/\n}" | |
params=( | |
AccessKeyId=$AccessKeyId | |
Format=JSON | |
ObjectPath=$ObjectPath | |
SignatureMethod=HMAC-SHA1 | |
SignatureNonce=`date +%s` | |
SignatureVersion=1.0 | |
Timestamp=`date -u +%Y-%m-%dT%H:%M:%SZ` | |
) | |
params_str=$(IFS='&' ; echo "${params[*]}") | |
sign_str="$Secret&POST&%2F&$params_str" | |
Signature=`echo -n $sign_str | openssl dgst -sha1 -hmac "$Secret&" -binary | base64` | |
params+=(Signature=$Signature) | |
echo "http --form https://cdn.aliyuncs.com ${params[@]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment