mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-12-24 15:22:42 +00:00
Compare commits
No commits in common. "f910aa814ab093fd3286ec190a2c983479f9ad7f" and "f7a3ebf2f3c28d40c1ae126f73ac6a8c9e22c2c6" have entirely different histories.
f910aa814a
...
f7a3ebf2f3
2 changed files with 23 additions and 57 deletions
|
|
@ -1,69 +1,37 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/env bash
|
||||||
# POSIX-compatible script to download Xray binary and GeoIP/GeoSite databases
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
XRAY_VERSION="v25.6.8"
|
|
||||||
BASE_URL="https://github.com/XTLS/Xray-core/releases/download/${XRAY_VERSION}"
|
|
||||||
DAT_DIR="build/bin"
|
|
||||||
ARCH="${1:-amd64}" # Default to amd64 if not provided
|
|
||||||
=======
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# DockerInit.sh <20> download and prepare Xray binaries and geolocation databases
|
# DockerInit.sh <20> download and prepare Xray binaries and geolocation databases
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Xray version
|
# Xray version
|
||||||
readonly XRAY_VERSION="v25.6.8"
|
readonly XRAY_VERSION="v25.6.8"
|
||||||
>>>>>>> f7a3ebf2f3c28d40c1ae126f73ac6a8c9e22c2c6
|
|
||||||
|
|
||||||
# Map architecture
|
# URL template for downloading Xray
|
||||||
case "$ARCH" in
|
readonly XRAY_URL_TEMPLATE="https://github.com/XTLS/Xray-core/releases/download/${XRAY_VERSION}/Xray-linux-%s.zip"
|
||||||
amd64) ARCH_SUFFIX="64"; FNAME="amd64" ;;
|
|
||||||
i386) ARCH_SUFFIX="32"; FNAME="i386" ;;
|
|
||||||
armv8|arm64|aarch64) ARCH_SUFFIX="arm64-v8a"; FNAME="arm64" ;;
|
|
||||||
armv7|arm|arm32) ARCH_SUFFIX="arm32-v7a"; FNAME="arm32" ;;
|
|
||||||
armv6) ARCH_SUFFIX="arm32-v6"; FNAME="armv6" ;;
|
|
||||||
*) ARCH_SUFFIX="64"; FNAME="amd64" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "Selected architecture: $ARCH → $ARCH_SUFFIX → $FNAME"
|
# Directories
|
||||||
|
readonly BUILD_DIR="build/bin"
|
||||||
|
readonly ROOT_DIR="$(pwd)"
|
||||||
|
|
||||||
# Create directory
|
# Check for required utilities
|
||||||
mkdir -p "$DAT_DIR"
|
check_dependencies() {
|
||||||
cd "$DAT_DIR"
|
local deps=(wget unzip)
|
||||||
|
for cmd in "${deps[@]}"; do
|
||||||
# Download and unpack Xray
|
if ! command -v "$cmd" &> /dev/null; then
|
||||||
XRAY_ZIP="Xray-linux-${ARCH_SUFFIX}.zip"
|
echo "Error: Required utility '$cmd' is not installed. Please install it and try again." >&2
|
||||||
echo "Downloading Xray: $XRAY_ZIP"
|
exit 1
|
||||||
wget -q "${BASE_URL}/${XRAY_ZIP}"
|
fi
|
||||||
unzip -q "$XRAY_ZIP"
|
done
|
||||||
rm -f "$XRAY_ZIP" geoip.dat geosite.dat
|
|
||||||
mv xray "xray-linux-${FNAME}"
|
|
||||||
chmod +x "xray-linux-${FNAME}"
|
|
||||||
echo "Xray extracted and renamed"
|
|
||||||
|
|
||||||
# Download primary databases
|
|
||||||
echo "Downloading official geoip/geosite..."
|
|
||||||
wget -q https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
|
|
||||||
wget -q https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
|
|
||||||
|
|
||||||
# Download region-specific datasets
|
|
||||||
download_variant() {
|
|
||||||
REGION="$1"
|
|
||||||
BASE_URL="$2"
|
|
||||||
echo "Downloading $REGION GeoIP/GeoSite..."
|
|
||||||
wget -q -O "geoip_${REGION}.dat" "${BASE_URL}/geoip.dat"
|
|
||||||
wget -q -O "geosite_${REGION}.dat" "${BASE_URL}/geosite.dat"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
download_variant "IR" "https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download"
|
# Print usage help
|
||||||
download_variant "RU" "https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download"
|
usage() {
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $0 <architecture>
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
echo "All files downloaded successfully."
|
|
||||||
cd ../../
|
|
||||||
=======
|
|
||||||
Supported architectures:
|
Supported architectures:
|
||||||
amd64 ? 64-bit x86
|
amd64 ? 64-bit x86
|
||||||
i386 ? 32-bit x86
|
i386 ? 32-bit x86
|
||||||
|
|
@ -185,4 +153,3 @@ fi
|
||||||
|
|
||||||
# Run main with the provided argument (if any)
|
# Run main with the provided argument (if any)
|
||||||
main "${1-}"
|
main "${1-}"
|
||||||
>>>>>>> f7a3ebf2f3c28d40c1ae126f73ac6a8c9e22c2c6
|
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,7 @@ RUN apk --no-cache --update add \
|
||||||
build-base \
|
build-base \
|
||||||
gcc \
|
gcc \
|
||||||
wget \
|
wget \
|
||||||
unzip \
|
unzip
|
||||||
bash
|
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue