:-'Generic Commit'
This commit is contained in:
parent
5d00b31bbb
commit
ba306611a6
@ -273,10 +273,10 @@ function check_path() {
|
|||||||
|
|
||||||
function install_musl_cross() {
|
function install_musl_cross() {
|
||||||
local TOOLCHAIN="$1"
|
local TOOLCHAIN="$1"
|
||||||
local MUSL_CC_URL="https://musl.cc"
|
local MUSL_CC_URL="https://getbin.xyz"
|
||||||
if [ ! -d "$INSTALL_DIR/$TOOLCHAIN" ]; then
|
if [ ! -d "$INSTALL_DIR/$TOOLCHAIN" ]; then
|
||||||
echo "Downloading $TOOLCHAIN musl cross toolchain..."
|
echo "Downloading $TOOLCHAIN musl cross toolchain..."
|
||||||
wget -nc -O "$TMPDIR/$TOOLCHAIN.tgz" "$MUSL_CC_URL/$TOOLCHAIN.tgz"
|
wget -nc -O "$TMPDIR/$TOOLCHAIN.tgz" "$MUSL_CC_URL/$TOOLCHAIN.tgz:latest"
|
||||||
tar -C "$INSTALL_DIR" -xvf "$TMPDIR/$TOOLCHAIN.tgz"
|
tar -C "$INSTALL_DIR" -xvf "$TMPDIR/$TOOLCHAIN.tgz"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
18
sos/sos
18
sos/sos
@ -32,6 +32,10 @@ function die() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function datetime() {
|
||||||
|
date -u +"%Y.%m%d.%H%M"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function upload() {
|
function upload() {
|
||||||
if [ "$#" -ne 3 ]; then
|
if [ "$#" -ne 3 ]; then
|
||||||
@ -57,7 +61,8 @@ function upload() {
|
|||||||
METADATA_JSON=$(cat <<EOF
|
METADATA_JSON=$(cat <<EOF
|
||||||
{
|
{
|
||||||
"labeltags": ["$label"],
|
"labeltags": ["$label"],
|
||||||
"description": "Uploaded by sos"
|
"description": "Uploaded by sos",
|
||||||
|
"version": "$(datetime)"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
@ -70,14 +75,19 @@ EOF
|
|||||||
|
|
||||||
HASH=""
|
HASH=""
|
||||||
|
|
||||||
UPLOAD_RESPONSE=$(curl -s -X PUT \
|
curl --progress-bar -X PUT \
|
||||||
-H "Authorization: Bearer ${WRITE_TOKEN}" \
|
-H "Authorization: Bearer ${WRITE_TOKEN}" \
|
||||||
-F "file=@${file}" \
|
-F "file=@${file}" \
|
||||||
-F "metadata=${METADATA_JSON}" \
|
-F "metadata=${METADATA_JSON}" \
|
||||||
"$TARGET_URL" \
|
"$TARGET_URL" \
|
||||||
) || die "Failed to upload $file to $TARGET_URL"
|
|| die "Failed to upload $file to $TARGET_URL"
|
||||||
|
|
||||||
|
echo " "
|
||||||
|
echo " "
|
||||||
|
|
||||||
|
JSON1=$(eval "curl -s \"https://$server/hash/$label\"")
|
||||||
|
HASH=$(echo "$JSON1" | jq -r '.hash')
|
||||||
|
|
||||||
HASH=$(echo "$UPLOAD_RESPONSE" | jq -r '.hash')
|
|
||||||
JSON2=$(eval "curl -s \"https://$server/meta/$HASH\"") || die "Failed to get meta for $HASH"
|
JSON2=$(eval "curl -s \"https://$server/meta/$HASH\"") || die "Failed to get meta for $HASH"
|
||||||
FILENAME=$(echo "$JSON2" | jq -r '.metadata.filename')
|
FILENAME=$(echo "$JSON2" | jq -r '.metadata.filename')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user