Files
SingboxForPanel/transit2minio.sh
2026-04-16 21:52:54 +08:00

35 lines
690 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
set -e
# MinIO 目标路径
DEST="myminio/downloads/singbox"
echo "请输入 Gitea Actions 编译好的 zip 文件路径本地路径或URL"
read -r FILE
# 判断 mc 是否可用
if ! command -v mc >/dev/null 2>&1; then
echo "错误mc 命令未安装"
exit 1
fi
# 如果是 URL先下载
if [[ "$FILE" =~ ^https?:// ]]; then
echo "检测到 URL开始下载..."
TMP_FILE="/tmp/$(basename "$FILE")"
curl -L "$FILE" -o "$TMP_FILE"
FILE="$TMP_FILE"
fi
# 判断文件是否存在
if [[ ! -f "$FILE" ]]; then
echo "错误:文件不存在 -> $FILE"
exit 1
fi
echo "开始上传到 MinIO$DEST"
mc cp "$FILE" "$DEST/"
echo "上传完成 ✅"