summary refs log tree commit diff
path: root/bin/b2
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2026-02-10 12:32:48 +0100
committerRobert Günzler <r@gnzler.io>2026-02-10 12:41:25 +0100
commit63feeb9f369fc6176e85c1c2d8fcc863caad1946 (patch)
tree41cd5d2d1ec36e74e464caab722cc9b460153f04 /bin/b2
parent5bd0a4aca65ecb9818ef1285982d160b6b6ff665 (diff)
start new
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'bin/b2')
-rwxr-xr-xbin/b262
1 files changed, 0 insertions, 62 deletions
diff --git a/bin/b2 b/bin/b2
deleted file mode 100755
index 07d1976..0000000
--- a/bin/b2
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/sh
-
-set -e
-
-cdn_uri=${B2CLI_CDN_URI:-cdn.example.com}
-bucket=${B2CLI_BUCKET:?missing bucket}
-b2_uri=${B2CLI_B2_URI:-f001.backblazeb2.com}
-
-canonical_uri() {
-	sed "s|${b2_uri}/file/${bucket}|${cdn_uri}/static|g"
-}
-
-list=
-delete=
-hash=
-while getopts Hldh opt; do
-	case "$opt" in
-	l) list=1 ;;
-	d) delete=1 ;;
-	H) hash=1 ;;
-	h | ?)
-		printf "usage: %s [-hld] [FILE] [DESTINATION]\n" "$(basename "$0")"
-		printf "\n"
-		printf "  -l       list\n"
-		printf "  -d       delete\n"
-		printf "  -H       hash as filename\n"
-		printf "\n"
-		printf "The default action is to put the FILE into the remote bucket\n"
-		exit 2
-		;;
-	esac
-done
-shift $((OPTIND - 1))
-
-file="${1}"
-dest=${2:-"$(basename "${file}")"}
-
-if [ -n "$list" ]; then
-	for lnk in $(rclone lsf -R b2:${bucket}/ | sort); do
-		echo "https://${b2_uri}/file/${bucket}/${lnk}" | canonical_uri
-	done
-	exit 0
-fi
-
-if [ -n "$delete" ]; then
-	rclone deletefile b2:${bucket}/"${file}"
-	printf "deleted: %s\n" "${file}" >&2
-	exit 0
-fi
-
-if [ -n "$hash" ]; then
-	ext="$(echo "${file}" | rev | cut -d\. -f1 | rev | sed -e "s#${file}##")"
-	[ -n "$ext" ] && ext=".${ext}"
-	sum=$(md5sum "$file" | cut -d\  -f1)
-	dest=$(echo "${dest}" | sed -e "s#$(basename "${file}")#${sum}${ext}#")
-fi
-
-rclone copyto "${file}" b2:${bucket}/"${dest}" >&2
-
-b2_share_link="https://${b2_uri}/file/${bucket}/${dest}"
-echo "${b2_share_link}" | sed "s|${b2_uri}|${cdn_uri}|" >&2
-echo "${b2_share_link}" | canonical_uri