Download arch utils

This commit is contained in:
2022-08-15 22:32:16 +08:00
parent e7562bf01f
commit 1dce4b450c
2 changed files with 28 additions and 4 deletions

View File

@@ -30,7 +30,7 @@ function kstore {
update) shift; kstore-update "$@" ;;
search) shift; kstore-search $@ ;;
secret) shift; kstore-secret $@ ;;
upload) shift; kstore-upload $@ ;;
sync) shift; kstore-sync $@ ;;
*)
__func_head "add [key] [value|file|-] [prop, default: $_KSTORE_DEF_PROP]"
__func_help "update [key] [value|file|-] [prop, default: $_KSTORE_DEF_PROP]"
@@ -289,6 +289,28 @@ function kstore-del {
fi
}
function kstore-dl-s3au {
local p tmp
p="https://git.k8s.astropenguin.net/penguin/s3-arch-utils/raw/branch/master"
which "$1" 2>&1 > /dev/null
if [ $? -ne 0 ]; then
tmp=$( mktemp )
__download "$p/$1" > $tmp
sha256sum $tmp | grep -q "$2"
if [ $? -eq 0 ]; then
mv $tmp "$RBASH_BIN/$1"
chmod +x "$RBASH_BIN/$1"
fi
fi
}
function kstore-sync {
kstore-dl-s3au "arch_download_aws4.sh" "f1c2e9c9de380d8e590f46a0cc0c320c711dcff3d7d34a1a86927e61030ae5b8" || return 1
kstore-dl-s3au "arch_upload_aws4.sh" "ca2229a5a7c98e8f5e692129a50b12457f8acbcb366a987cf3d8101cc4b38667" || return 1
}
function kstore-search {
local _termk _termp _cond
_termk=`kstore-quote "$1"`