1111
This commit is contained in:
parent
330be24f9b
commit
985608bfe7
10
README.md
10
README.md
@ -4,6 +4,16 @@
|
|||||||
|
|
||||||
## 安装步骤
|
## 安装步骤
|
||||||
|
|
||||||
|
|
||||||
|
### 一键安装方法, install.sh
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -o install.sh https://x-mo.cn:9009/XiaoMo/alist-proxy/raw/branch/master/install.sh && chmod +x install.sh && ./install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 使用 Node.js 版本
|
### 使用 Node.js 版本
|
||||||
|
|
||||||
1. **下载代理脚本**
|
1. **下载代理脚本**
|
||||||
|
108
install.sh
Normal file
108
install.sh
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Determine OS and architecture
|
||||||
|
OS=$(uname -s)
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
|
||||||
|
# swoole-cli 版本号
|
||||||
|
VERSION="5.1.4"
|
||||||
|
|
||||||
|
# Set the download URL based on OS and architecture
|
||||||
|
case "$OS" in
|
||||||
|
Linux)
|
||||||
|
case "$ARCH" in
|
||||||
|
arm64)
|
||||||
|
FILE_URL="https://wenda-1252906962.file.myqcloud.com/dist/swoole-cli-v${VERSION}-linux-arm64.tar.xz"
|
||||||
|
;;
|
||||||
|
x86_64)
|
||||||
|
FILE_URL="https://wenda-1252906962.file.myqcloud.com/dist/swoole-cli-v${VERSION}-linux-x64.tar.xz"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported architecture: $ARCH"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
Darwin)
|
||||||
|
case "$ARCH" in
|
||||||
|
arm64)
|
||||||
|
FILE_URL="https://wenda-1252906962.file.myqcloud.com/dist/swoole-cli-v${VERSION}-macos-arm64.tar.xz"
|
||||||
|
;;
|
||||||
|
x86_64)
|
||||||
|
FILE_URL="https://wenda-1252906962.file.myqcloud.com/dist/swoole-cli-v${VERSION}-macos-x64.tar.xz"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported architecture: $ARCH"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported OS: $OS"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Check if Node.js is installed
|
||||||
|
if command -v node &> /dev/null; then
|
||||||
|
echo "Node.js is installed. Proceeding with Node.js script setup."
|
||||||
|
|
||||||
|
# Download the Node.js proxy script
|
||||||
|
echo "Downloading index.js..."
|
||||||
|
if ! curl -o "index.js" "https://x-mo.cn:9009/XiaoMo/alist-proxy/raw/branch/master/index.js"; then
|
||||||
|
echo "Failed to download index.js. Please check your internet connection and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the Node.js proxy service
|
||||||
|
echo "Running Node.js proxy service..."
|
||||||
|
node index.js
|
||||||
|
else
|
||||||
|
echo "Node.js is not installed. Proceeding with swoole-cli setup."
|
||||||
|
|
||||||
|
# Set the fixed file name
|
||||||
|
FILE_NAME="swoole-cli.tar.xz"
|
||||||
|
|
||||||
|
# Create a temporary directory
|
||||||
|
TEMP_DIR=$(mktemp -d)
|
||||||
|
mkdir -p "$TEMP_DIR"
|
||||||
|
|
||||||
|
# Download the file to the temporary directory
|
||||||
|
echo "Downloading $FILE_NAME from $FILE_URL to $TEMP_DIR..."
|
||||||
|
if ! curl -o "$TEMP_DIR/$FILE_NAME" "$FILE_URL"; then
|
||||||
|
echo "Download failed. Please check your internet connection and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify the download
|
||||||
|
if [ ! -f "$TEMP_DIR/$FILE_NAME" ]; then
|
||||||
|
echo "Downloaded file not found in $TEMP_DIR. Download may have failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract the file to the temporary directory
|
||||||
|
tar -xf "$TEMP_DIR/$FILE_NAME" -C "$TEMP_DIR" || {
|
||||||
|
echo "Extraction failed. Please make sure you have the necessary tools to extract the file."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Move the extracted file to the current directory
|
||||||
|
mv "$TEMP_DIR"/swoole-cli .
|
||||||
|
|
||||||
|
# Remove unnecessary files
|
||||||
|
echo "Removing unnecessary files..."
|
||||||
|
rm -rf "$TEMP_DIR"
|
||||||
|
|
||||||
|
# Check if index.php file exists, if not, download it
|
||||||
|
if [ ! -f "index.php" ]; then
|
||||||
|
echo "Downloading index.php..."
|
||||||
|
if ! curl -o "index.php" "https://x-mo.cn:9009/XiaoMo/alist-proxy/raw/branch/master/index.php"; then
|
||||||
|
echo "Failed to download index.php. Please check your internet connection and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the PHP indexer
|
||||||
|
echo "Running PHP indexer..."
|
||||||
|
./swoole-cli ./index.php
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user