:-'Generic Commit'

This commit is contained in:
Your Name 2025-05-30 19:02:32 +12:00
parent cd7d2535a4
commit c33ca6f4b4
4 changed files with 45 additions and 7 deletions

View File

@ -9,7 +9,7 @@ Tools are installed to ~/.local/bin/dropshell-tool, and the tool name is added t
Just use dropshell-tool. You can install with: Just use dropshell-tool. You can install with:
``` ```
curl https://getbin.xyz/dropshell-tool:latest curl https://getbin.xyz/dropshell-tool-install.sh | bash
``` ```

11
dropshell-tool-install.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

15
publish_all.sh Normal file → Executable file
View File

@ -1,5 +1,20 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# run sos to upload dropshell-tool-install.sh
"${SCRIPT_DIR}/sos/sos" upload "${SCRIPT_DIR}/dropshell-tool-install.sh" "dropshell-tool-install.sh"
# build and publish all dropshell tools
# build and publish all dropshell tools # build and publish all dropshell tools

24
sos/sos
View File

@ -49,20 +49,32 @@ function upload() {
[ -f "$file" ] || die "File not found: $file" [ -f "$file" ] || die "File not found: $file"
# if the label doesn't have a tag, add :lastest
if [[ ! "$label" =~ : ]]; then
label="$label:latest"
fi
# upload the file # upload the file
TARGET_URL="https://$server/upload" TARGET_URL="https://$server/upload"
echo "Uploading $file to $TARGET_URL" echo "Uploading $file to $TARGET_URL"
DATETIME=$(datetime)
# if the label doesn't have a tag, add :lastest
[[ "$label" =~ : ]] || label="$label:latest"
label_base=$(echo "$label" | cut -d':' -f1)
LABELTAGS=(
"$label"
"$label_base:$DATETIME"
"$label_base:latest"
)
# deduplicate the labeltags
mapfile -t LABELTAGS < <(printf "%s\n" "${LABELTAGS[@]}" | sort -u)
LABELTAGS_JSON=$(printf '"%s",' "${LABELTAGS[@]}")
LABELTAGS_JSON="[${LABELTAGS_JSON%,}]"
METADATA_JSON=$(cat <<EOF METADATA_JSON=$(cat <<EOF
{ {
"labeltags": ["$label"], "labeltags": "$LABELTAGS_JSON",
"description": "Uploaded by sos", "description": "Uploaded by sos",
"version": "$(datetime)" "version": "$DATETIME"
} }
EOF EOF
) )