mirror of https://github.com/2dust/v2rayN
Update package-rhel.sh
parent
6ffb3bd30c
commit
f395c5feb3
|
@ -390,25 +390,30 @@ download_mihomo() {
|
||||||
chmod +x "$outroot/bin/mihomo/mihomo" || true
|
chmod +x "$outroot/bin/mihomo/mihomo" || true
|
||||||
}
|
}
|
||||||
|
|
||||||
# Move geo files to a unified path: outroot/bin/xray/
|
# Move geo files to a unified path: outroot/bin/ (NOT bin/xray/)
|
||||||
unify_geo_layout() {
|
unify_geo_layout() {
|
||||||
local outroot="$1"
|
local outroot="$1"
|
||||||
mkdir -p "$outroot/bin/xray"
|
mkdir -p "$outroot/bin"
|
||||||
local srcs=( \
|
local names=( \
|
||||||
"$outroot/bin/geosite.dat" \
|
"geosite.dat" \
|
||||||
"$outroot/bin/geoip.dat" \
|
"geoip.dat" \
|
||||||
"$outroot/bin/geoip-only-cn-private.dat" \
|
"geoip-only-cn-private.dat" \
|
||||||
"$outroot/bin/Country.mmdb" \
|
"Country.mmdb" \
|
||||||
"$outroot/bin/geoip.metadb" \
|
"geoip.metadb" \
|
||||||
)
|
)
|
||||||
for s in "${srcs[@]}"; do
|
for n in "${names[@]}"; do
|
||||||
if [[ -f "$s" ]]; then
|
# If file exists under bin/xray/, move it up to bin/
|
||||||
mv -f "$s" "$outroot/bin/xray/$(basename "$s")"
|
if [[ -f "$outroot/bin/xray/$n" ]]; then
|
||||||
|
mv -f "$outroot/bin/xray/$n" "$outroot/bin/$n"
|
||||||
|
fi
|
||||||
|
# If file already in bin/, leave it as-is
|
||||||
|
if [[ -f "$outroot/bin/$n" ]]; then
|
||||||
|
:
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download geo/rule assets; then unify to bin/xray/
|
# Download geo/rule assets; then unify to bin/
|
||||||
download_geo_assets() {
|
download_geo_assets() {
|
||||||
local outroot="$1"
|
local outroot="$1"
|
||||||
local bin_dir="$outroot/bin"
|
local bin_dir="$outroot/bin"
|
||||||
|
@ -442,7 +447,7 @@ download_geo_assets() {
|
||||||
"https://raw.githubusercontent.com/2dust/sing-box-rules/rule-set-geosite/$f" || true
|
"https://raw.githubusercontent.com/2dust/sing-box-rules/rule-set-geosite/$f" || true
|
||||||
done
|
done
|
||||||
|
|
||||||
# Unify to bin/xray/
|
# Unify to bin/
|
||||||
unify_geo_layout "$outroot"
|
unify_geo_layout "$outroot"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +485,7 @@ download_v2rayn_bundle() {
|
||||||
rm -rf "$nested_dir"
|
rm -rf "$nested_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Unify to bin/xray/
|
# Unify to bin/
|
||||||
unify_geo_layout "$outroot"
|
unify_geo_layout "$outroot"
|
||||||
|
|
||||||
echo "[+] Bundle extracted to $outroot"
|
echo "[+] Bundle extracted to $outroot"
|
||||||
|
@ -629,25 +634,13 @@ https://github.com/2dust/v2rayN
|
||||||
install -dm0755 %{buildroot}/opt/v2rayN
|
install -dm0755 %{buildroot}/opt/v2rayN
|
||||||
cp -a * %{buildroot}/opt/v2rayN/
|
cp -a * %{buildroot}/opt/v2rayN/
|
||||||
|
|
||||||
# Launcher (prefer native ELF first, then DLL fallback; also create Geo symlinks for the user)
|
# Launcher (prefer native ELF first, then DLL fallback)
|
||||||
install -dm0755 %{buildroot}%{_bindir}
|
install -dm0755 %{buildroot}%{_bindir}
|
||||||
cat > %{buildroot}%{_bindir}/v2rayn << 'EOF'
|
cat > %{buildroot}%{_bindir}/v2rayn << 'EOF'
|
||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
DIR="/opt/v2rayN"
|
DIR="/opt/v2rayN"
|
||||||
|
|
||||||
# --- Symlink GEO files into user's XDG dir (first-run convenience) ---
|
|
||||||
XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
|
||||||
USR_GEO_DIR="$XDG_DATA_HOME/v2rayN/bin"
|
|
||||||
SYS_XRAY_DIR="$DIR/bin/xray"
|
|
||||||
mkdir -p "$USR_GEO_DIR"
|
|
||||||
for f in geosite.dat geoip.dat geoip-only-cn-private.dat Country.mmdb; do
|
|
||||||
if [[ -f "$SYS_XRAY_DIR/$f" && ! -e "$USR_GEO_DIR/$f" ]]; then
|
|
||||||
ln -s "$SYS_XRAY_DIR/$f" "$USR_GEO_DIR/$f" || true
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
# --- end GEO ---
|
|
||||||
|
|
||||||
# Prefer native apphost
|
# Prefer native apphost
|
||||||
if [[ -x "$DIR/v2rayN" ]]; then exec "$DIR/v2rayN" "$@"; fi
|
if [[ -x "$DIR/v2rayN" ]]; then exec "$DIR/v2rayN" "$@"; fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue