diff --git a/README.md b/README.md index e11ae84..384b6dd 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,7 @@ VERSION=v0.1.0 curl -sSL https://git.littlediary.cn/CN-JS-HuiBai/PromdataPanel/r ```bash # 进入程序目录 -cd /opt/promdata-panel -# 执行更新脚本 -chmod +x update.sh && ./update.sh +curl -sSL https://git.littlediary.cn/CN-JS-HuiBai/PromdataPanel/raw/branch/main/update.sh | bash ``` #### 3. 系统初始化 diff --git a/update.sh b/update.sh index fe7bae2..8b90cb9 100644 --- a/update.sh +++ b/update.sh @@ -34,16 +34,30 @@ if [ -d ".git" ]; then else echo -e "${BLUE}No git repository found. Updating via ZIP archive...${NC}" - # URL for zip download (adjust as needed for specific versioning) - ZIP_URL="https://git.littlediary.cn/CN-JS-HuiBai/PromdataPanel/archive/main.tar.gz" + # URL for zip download + ZIP_URL="https://git.littlediary.cn/CN-JS-HuiBai/PromdataPanel/archive/main.zip" TEMP_DIR="/tmp/promdata_update_$(date +%s)" mkdir -p "$TEMP_DIR" - echo "Downloading latest version..." - curl -L "$ZIP_URL" -o "$TEMP_DIR/latest.tar.gz" + echo "Downloading latest version (main branch)..." + curl -L "$ZIP_URL" -o "$TEMP_DIR/latest.zip" + # Ensure unzip is available + if ! command -v unzip &> /dev/null; then + echo -e "${BLUE}unzip is not installed. Attempting to install it...${NC}" + if command -v apt-get &> /dev/null; then + sudo apt-get update && sudo apt-get install -y unzip + elif command -v dnf &> /dev/null; then + sudo dnf install -y unzip + elif command -v yum &> /dev/null; then + sudo yum install -y yum-utils && sudo yum install -y unzip + elif command -v apk &> /dev/null; then + sudo apk add unzip + fi + fi + echo "Extracting archive..." - tar -xzf "$TEMP_DIR/latest.tar.gz" -C "$TEMP_DIR" + unzip -q "$TEMP_DIR/latest.zip" -d "$TEMP_DIR" # The extracted folder is usually named project-main or similar EXTRACTED_FOLDER=$(ls -d "$TEMP_DIR"/*/ | head -n 1)