mirror of
https://github.com/2dust/v2rayN.git
synced 2026-03-04 07:03:04 +00:00
Compare commits
No commits in common. "22c233f0cdffe9177e60509bb3b34c06cf253550" and "c8d89e3dce85e772e16d31fe797d5538f9e59b40" have entirely different histories.
22c233f0cd
...
c8d89e3dce
10 changed files with 103 additions and 38 deletions
15
.github/workflows/build-linux.yml
vendored
15
.github/workflows/build-linux.yml
vendored
|
|
@ -68,6 +68,21 @@ jobs:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
|
||||||
|
- name: Package AppImage
|
||||||
|
if: github.event.inputs.release_tag != ''
|
||||||
|
run: |
|
||||||
|
chmod a+x package-appimage.sh
|
||||||
|
./package-appimage.sh
|
||||||
|
|
||||||
|
- name: Upload AppImage to release
|
||||||
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
if: github.event.inputs.release_tag != ''
|
||||||
|
with:
|
||||||
|
file: ${{ github.workspace }}/v2rayN*.AppImage
|
||||||
|
tag: ${{ github.event.inputs.release_tag }}
|
||||||
|
file_glob: true
|
||||||
|
prerelease: true
|
||||||
|
|
||||||
# release zip archive
|
# release zip archive
|
||||||
- name: Package release zip archive
|
- name: Package release zip archive
|
||||||
if: github.event.inputs.release_tag != ''
|
if: github.event.inputs.release_tag != ''
|
||||||
|
|
|
||||||
67
package-appimage.sh
Normal file
67
package-appimage.sh
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Install deps
|
||||||
|
sudo apt update -y
|
||||||
|
sudo apt install -y libfuse2 wget file
|
||||||
|
|
||||||
|
# Get tools
|
||||||
|
wget -qO appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
|
||||||
|
chmod +x appimagetool
|
||||||
|
|
||||||
|
# x86_64 AppDir
|
||||||
|
APPDIR_X64="AppDir-x86_64"
|
||||||
|
rm -rf "$APPDIR_X64"
|
||||||
|
mkdir -p "$APPDIR_X64/usr/lib/v2rayN" "$APPDIR_X64/usr/bin" "$APPDIR_X64/usr/share/applications" "$APPDIR_X64/usr/share/pixmaps"
|
||||||
|
cp -rf "$OutputPath64"/* "$APPDIR_X64/usr/lib/v2rayN" || true
|
||||||
|
[ -f "$APPDIR_X64/usr/lib/v2rayN/v2rayN.png" ] && cp "$APPDIR_X64/usr/lib/v2rayN/v2rayN.png" "$APPDIR_X64/usr/share/pixmaps/v2rayN.png" || true
|
||||||
|
[ -f "$APPDIR_X64/usr/lib/v2rayN/v2rayN.png" ] && cp "$APPDIR_X64/usr/lib/v2rayN/v2rayN.png" "$APPDIR_X64/v2rayN.png" || true
|
||||||
|
|
||||||
|
printf '%s\n' '#!/bin/sh' 'HERE="$(dirname "$(readlink -f "$0")")"' 'cd "$HERE/usr/lib/v2rayN"' 'exec "$HERE/usr/lib/v2rayN/v2rayN" "$@"' > "$APPDIR_X64/AppRun"
|
||||||
|
chmod +x "$APPDIR_X64/AppRun"
|
||||||
|
ln -sf usr/lib/v2rayN/v2rayN "$APPDIR_X64/usr/bin/v2rayN"
|
||||||
|
cat > "$APPDIR_X64/v2rayN.desktop" <<EOF
|
||||||
|
[Desktop Entry]
|
||||||
|
Name=v2rayN
|
||||||
|
Comment=A GUI client for Windows and Linux, support Xray core and sing-box-core and others
|
||||||
|
Exec=v2rayN
|
||||||
|
Icon=v2rayN
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
||||||
|
Categories=Network;
|
||||||
|
EOF
|
||||||
|
install -Dm644 "$APPDIR_X64/v2rayN.desktop" "$APPDIR_X64/usr/share/applications/v2rayN.desktop"
|
||||||
|
|
||||||
|
ARCH=x86_64 ./appimagetool "$APPDIR_X64" "v2rayN-${OutputArch}.AppImage"
|
||||||
|
file "v2rayN-${OutputArch}.AppImage" | grep -q 'x86-64'
|
||||||
|
|
||||||
|
# aarch64 AppDir
|
||||||
|
APPDIR_ARM64="AppDir-aarch64"
|
||||||
|
rm -rf "$APPDIR_ARM64"
|
||||||
|
mkdir -p "$APPDIR_ARM64/usr/lib/v2rayN" "$APPDIR_ARM64/usr/bin" "$APPDIR_ARM64/usr/share/applications" "$APPDIR_ARM64/usr/share/pixmaps"
|
||||||
|
cp -rf "$OutputPathArm64"/* "$APPDIR_ARM64/usr/lib/v2rayN" || true
|
||||||
|
[ -f "$APPDIR_ARM64/usr/lib/v2rayN/v2rayN.png" ] && cp "$APPDIR_ARM64/usr/lib/v2rayN/v2rayN.png" "$APPDIR_ARM64/usr/share/pixmaps/v2rayN.png" || true
|
||||||
|
[ -f "$APPDIR_ARM64/usr/lib/v2rayN/v2rayN.png" ] && cp "$APPDIR_ARM64/usr/lib/v2rayN/v2rayN.png" "$APPDIR_ARM64/v2rayN.png" || true
|
||||||
|
|
||||||
|
printf '%s\n' '#!/bin/sh' 'HERE="$(dirname "$(readlink -f "$0")")"' 'cd "$HERE/usr/lib/v2rayN"' 'exec "$HERE/usr/lib/v2rayN/v2rayN" "$@"' > "$APPDIR_ARM64/AppRun"
|
||||||
|
chmod +x "$APPDIR_ARM64/AppRun"
|
||||||
|
ln -sf usr/lib/v2rayN/v2rayN "$APPDIR_ARM64/usr/bin/v2rayN"
|
||||||
|
cat > "$APPDIR_ARM64/v2rayN.desktop" <<EOF
|
||||||
|
[Desktop Entry]
|
||||||
|
Name=v2rayN
|
||||||
|
Comment=A GUI client for Windows and Linux, support Xray core and sing-box-core and others
|
||||||
|
Exec=v2rayN
|
||||||
|
Icon=v2rayN
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
||||||
|
Categories=Network;
|
||||||
|
EOF
|
||||||
|
install -Dm644 "$APPDIR_ARM64/v2rayN.desktop" "$APPDIR_ARM64/usr/share/applications/v2rayN.desktop"
|
||||||
|
|
||||||
|
# aarch64 runtime
|
||||||
|
wget -qO runtime-aarch64 https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-aarch64
|
||||||
|
chmod +x runtime-aarch64
|
||||||
|
|
||||||
|
# build aarch64 AppImage
|
||||||
|
ARCH=aarch64 ./appimagetool --runtime-file ./runtime-aarch64 "$APPDIR_ARM64" "v2rayN-${OutputArchArm}.AppImage"
|
||||||
|
file "v2rayN-${OutputArchArm}.AppImage" | grep -q 'ARM aarch64'
|
||||||
|
|
@ -28,7 +28,7 @@ Package: v2rayN
|
||||||
Version: $Version
|
Version: $Version
|
||||||
Architecture: $Arch2
|
Architecture: $Arch2
|
||||||
Maintainer: https://github.com/2dust/v2rayN
|
Maintainer: https://github.com/2dust/v2rayN
|
||||||
Depends: libc6 (>= 2.34), fontconfig (>= 2.13.1), desktop-file-utils (>= 0.26), xdg-utils (>= 1.1.3), coreutils (>= 8.32), bash (>= 5.1)
|
Depends: desktop-file-utils, xdg-utils
|
||||||
Description: A GUI client for Windows and Linux, support Xray core and sing-box-core and others
|
Description: A GUI client for Windows and Linux, support Xray core and sing-box-core and others
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -614,13 +614,8 @@ ExclusiveArch: aarch64 x86_64
|
||||||
Source0: __PKGROOT__.tar.gz
|
Source0: __PKGROOT__.tar.gz
|
||||||
|
|
||||||
# Runtime dependencies (Avalonia / X11 / Fonts / GL)
|
# Runtime dependencies (Avalonia / X11 / Fonts / GL)
|
||||||
Requires: freetype, cairo, pango, openssl, mesa-libEGL, mesa-libGL
|
Requires: libX11, libXrandr, libXcursor, libXi, libXext, libxcb, libXrender, libXfixes, libXinerama, libxkbcommon
|
||||||
Requires: glibc >= 2.34
|
Requires: fontconfig, freetype, cairo, pango, mesa-libEGL, mesa-libGL, xdg-utils
|
||||||
Requires: fontconfig >= 2.13.1
|
|
||||||
Requires: desktop-file-utils >= 0.26
|
|
||||||
Requires: xdg-utils >= 1.1.3
|
|
||||||
Requires: coreutils >= 8.32
|
|
||||||
Requires: bash >= 5.1
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
v2rayN Linux for Red Hat Enterprise Linux
|
v2rayN Linux for Red Hat Enterprise Linux
|
||||||
|
|
|
||||||
|
|
@ -994,6 +994,11 @@ public class Utils
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("APPIMAGE")))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
var exePath = GetExePath();
|
var exePath = GetExePath();
|
||||||
var baseDir = string.IsNullOrEmpty(exePath) ? StartupPath() : Path.GetDirectoryName(exePath) ?? "";
|
var baseDir = string.IsNullOrEmpty(exePath) ? StartupPath() : Path.GetDirectoryName(exePath) ?? "";
|
||||||
var p = baseDir.Replace('\\', '/');
|
var p = baseDir.Replace('\\', '/');
|
||||||
|
|
@ -1003,6 +1008,11 @@ public class Utils
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p.Contains("/.mount_", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (p.StartsWith("/opt/v2rayN", StringComparison.OrdinalIgnoreCase))
|
if (p.StartsWith("/opt/v2rayN", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public class CoreAdminManager
|
||||||
StringBuilder sb = new();
|
StringBuilder sb = new();
|
||||||
sb.AppendLine("#!/bin/bash");
|
sb.AppendLine("#!/bin/bash");
|
||||||
var cmdLine = $"{fileName.AppendQuotes()} {string.Format(coreInfo.Arguments, Utils.GetBinConfigPath(configPath).AppendQuotes())}";
|
var cmdLine = $"{fileName.AppendQuotes()} {string.Format(coreInfo.Arguments, Utils.GetBinConfigPath(configPath).AppendQuotes())}";
|
||||||
sb.AppendLine($"exec sudo -S -- {cmdLine}");
|
sb.AppendLine($"sudo -S {cmdLine}");
|
||||||
var shFilePath = await FileManager.CreateLinuxShellFile("run_as_sudo.sh", sb.ToString(), true);
|
var shFilePath = await FileManager.CreateLinuxShellFile("run_as_sudo.sh", sb.ToString(), true);
|
||||||
|
|
||||||
var procService = new ProcessService(
|
var procService = new ProcessService(
|
||||||
|
|
|
||||||
|
|
@ -28,15 +28,15 @@ fi
|
||||||
kill_children() {
|
kill_children() {
|
||||||
local parent=$1
|
local parent=$1
|
||||||
local children=$(ps -o pid --no-headers --ppid "$parent")
|
local children=$(ps -o pid --no-headers --ppid "$parent")
|
||||||
|
|
||||||
# Output information about processes being terminated
|
# Output information about processes being terminated
|
||||||
echo "Processing children of PID: $parent..."
|
echo "Processing children of PID: $parent..."
|
||||||
|
|
||||||
# Process each child
|
# Process each child
|
||||||
for child in $children; do
|
for child in $children; do
|
||||||
# Recursively find and kill child's children first
|
# Recursively find and kill child's children first
|
||||||
kill_children "$child"
|
kill_children "$child"
|
||||||
|
|
||||||
# Force kill the child process
|
# Force kill the child process
|
||||||
echo "Terminating child process: $child"
|
echo "Terminating child process: $child"
|
||||||
kill -9 "$child" 2>/dev/null || true
|
kill -9 "$child" 2>/dev/null || true
|
||||||
|
|
@ -47,18 +47,6 @@ echo "============================================"
|
||||||
echo "Starting termination of process $PID and all its children"
|
echo "Starting termination of process $PID and all its children"
|
||||||
echo "============================================"
|
echo "============================================"
|
||||||
|
|
||||||
# Try graceful termination first
|
|
||||||
echo "Attempting graceful termination (SIGTERM) of PID: $PID"
|
|
||||||
kill -15 "$PID" 2>/dev/null || true
|
|
||||||
sleep 1
|
|
||||||
# If still running, fall back to kill_children
|
|
||||||
if ps -p $PID > /dev/null; then
|
|
||||||
echo "Process $PID did not exit after SIGTERM; proceeding with forced termination of its children and itself"
|
|
||||||
else
|
|
||||||
echo "Process $PID exited cleanly after SIGTERM"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Find and kill all child processes
|
# Find and kill all child processes
|
||||||
kill_children "$PID"
|
kill_children "$PID"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,20 +42,6 @@ echo "============================================"
|
||||||
echo "Starting termination of process $PID and all its descendants"
|
echo "Starting termination of process $PID and all its descendants"
|
||||||
echo "============================================"
|
echo "============================================"
|
||||||
|
|
||||||
# Try graceful termination first
|
|
||||||
echo "Attempting graceful termination (SIGTERM) of PID: $PID"
|
|
||||||
kill -15 "$PID" 2>/dev/null || true
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
# If still running, fall back to kill_descendants
|
|
||||||
# Use the macOS-native 'kill -0' check
|
|
||||||
if kill -0 $PID 2>/dev/null; then
|
|
||||||
echo "Process $PID did not exit after SIGTERM; proceeding with forced termination of its descendants and itself"
|
|
||||||
else
|
|
||||||
echo "Process $PID exited cleanly after SIGTERM"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Find and kill all descendant processes
|
# Find and kill all descendant processes
|
||||||
kill_descendants "$PID"
|
kill_descendants "$PID"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Action", "GitHub Act
|
||||||
..\.github\workflows\build-osx.yml = ..\.github\workflows\build-osx.yml
|
..\.github\workflows\build-osx.yml = ..\.github\workflows\build-osx.yml
|
||||||
..\.github\workflows\build-windows-desktop.yml = ..\.github\workflows\build-windows-desktop.yml
|
..\.github\workflows\build-windows-desktop.yml = ..\.github\workflows\build-windows-desktop.yml
|
||||||
..\.github\workflows\build-windows.yml = ..\.github\workflows\build-windows.yml
|
..\.github\workflows\build-windows.yml = ..\.github\workflows\build-windows.yml
|
||||||
|
..\package-appimage.sh = ..\package-appimage.sh
|
||||||
..\package-debian.sh = ..\package-debian.sh
|
..\package-debian.sh = ..\package-debian.sh
|
||||||
..\package-osx.sh = ..\package-osx.sh
|
..\package-osx.sh = ..\package-osx.sh
|
||||||
..\package-release-zip.sh = ..\package-release-zip.sh
|
..\package-release-zip.sh = ..\package-release-zip.sh
|
||||||
|
..\pkg2appimage.yml = ..\pkg2appimage.yml
|
||||||
..\.github\workflows\winget-publish.yml = ..\.github\workflows\winget-publish.yml
|
..\.github\workflows\winget-publish.yml = ..\.github\workflows\winget-publish.yml
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,11 @@
|
||||||
<File Path="../.github/workflows/build-windows-desktop.yml" />
|
<File Path="../.github/workflows/build-windows-desktop.yml" />
|
||||||
<File Path="../.github/workflows/build-windows.yml" />
|
<File Path="../.github/workflows/build-windows.yml" />
|
||||||
<File Path="../.github/workflows/winget-publish.yml" />
|
<File Path="../.github/workflows/winget-publish.yml" />
|
||||||
|
<File Path="../package-appimage.sh" />
|
||||||
<File Path="../package-debian.sh" />
|
<File Path="../package-debian.sh" />
|
||||||
<File Path="../package-osx.sh" />
|
<File Path="../package-osx.sh" />
|
||||||
<File Path="../package-release-zip.sh" />
|
<File Path="../package-release-zip.sh" />
|
||||||
|
<File Path="../pkg2appimage.yml" />
|
||||||
</Folder>
|
</Folder>
|
||||||
<Folder Name="/Solution Files/">
|
<Folder Name="/Solution Files/">
|
||||||
<File Path="Directory.Build.props" />
|
<File Path="Directory.Build.props" />
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue