升级数据库

This commit is contained in:
CN-JS-HuiBai
2026-04-06 16:39:19 +08:00
parent 480cdf3f6d
commit 50818b54ca
2 changed files with 20 additions and 8 deletions

View File

@@ -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)