2017-08-08 18:36:29 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
die() {
|
|
|
|
echo >&2 "$@"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2017-08-11 13:50:38 +00:00
|
|
|
(( $# >= 2 )) || die "Usage: $0 TOKEN-FILE SYMBOL-ARCHIVE..."
|
|
|
|
token="$1"
|
|
|
|
shift
|
2017-08-08 18:36:29 +00:00
|
|
|
|
2017-08-11 13:50:38 +00:00
|
|
|
[[ -f $token && -s $token ]] || die "Invalid TOKEN-FILE ${token@Q}"
|
|
|
|
|
|
|
|
for zip; do
|
|
|
|
[[ $(file -Ebi "$zip") == application/zip* ]] || die "Invalid SYMBOL-ARCHIVE ${zip@Q}"
|
|
|
|
done
|
|
|
|
|
|
|
|
for zip; do
|
|
|
|
echo >&2 "Uploading ${zip@Q} ..."
|
|
|
|
curl -X POST -H "Auth-Token: $(<"$token")" -F "${zip##*/}=@$zip" \
|
2017-12-08 00:13:22 +00:00
|
|
|
https://symbols.mozilla.org/upload/
|
2017-08-11 13:50:38 +00:00
|
|
|
echo
|
|
|
|
done
|