mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-27 18:42:52 +00:00
Compare commits
1 commit
59770a8515
...
d2c62f0d59
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2c62f0d59 |
3 changed files with 50 additions and 66 deletions
|
|
@ -1,67 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Install deps
|
|
||||||
sudo apt update -y
|
sudo apt update -y
|
||||||
sudo apt install -y libfuse2 wget file
|
sudo apt install -y libfuse2
|
||||||
|
wget -O pkg2appimage https://github.com/AppImageCommunity/pkg2appimage/releases/download/continuous/pkg2appimage-1eceb30-x86_64.AppImage
|
||||||
# Get tools
|
chmod a+x pkg2appimage
|
||||||
wget -qO appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
|
export AppImageOutputArch=$OutputArch
|
||||||
chmod +x appimagetool
|
export OutputPath=$OutputPath64
|
||||||
|
./pkg2appimage ./pkg2appimage.yml
|
||||||
# x86_64 AppDir
|
mv out/*.AppImage v2rayN-${AppImageOutputArch}.AppImage
|
||||||
APPDIR_X64="AppDir-x86_64"
|
export AppImageOutputArch=$OutputArchArm
|
||||||
rm -rf "$APPDIR_X64"
|
export OutputPath=$OutputPathArm64
|
||||||
mkdir -p "$APPDIR_X64/usr/lib/v2rayN" "$APPDIR_X64/usr/bin" "$APPDIR_X64/usr/share/applications" "$APPDIR_X64/usr/share/pixmaps"
|
./pkg2appimage ./pkg2appimage.yml
|
||||||
cp -rf "$OutputPath64"/* "$APPDIR_X64/usr/lib/v2rayN" || true
|
mv out/*.AppImage v2rayN-${AppImageOutputArch}.AppImage
|
||||||
[ -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'
|
|
||||||
|
|
|
||||||
37
pkg2appimage.yml
Normal file
37
pkg2appimage.yml
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
app: v2rayN
|
||||||
|
binpatch: true
|
||||||
|
|
||||||
|
ingredients:
|
||||||
|
script:
|
||||||
|
- export FileName="v2rayN-${AppImageOutputArch}.zip"
|
||||||
|
- wget -nv -O $FileName "https://github.com/2dust/v2rayN-core-bin/raw/refs/heads/master/${FileName}"
|
||||||
|
- 7z x $FileName -aoa
|
||||||
|
- cp -rf v2rayN-${AppImageOutputArch}/* $OutputPath
|
||||||
|
|
||||||
|
script:
|
||||||
|
- mkdir -p usr/bin usr/lib
|
||||||
|
- cp -rf $OutputPath usr/lib/v2rayN
|
||||||
|
- echo "When this file exists, app will not store configs under this folder" > usr/lib/v2rayN/NotStoreConfigHere.txt
|
||||||
|
- ln -sf usr/lib/v2rayN/v2rayN usr/bin/v2rayN
|
||||||
|
- chmod a+x usr/lib/v2rayN/v2rayN
|
||||||
|
- find usr -type f -exec sh -c 'file "{}" | grep -qi "executable" && chmod +x "{}"' \;
|
||||||
|
- install -Dm644 usr/lib/v2rayN/v2rayN.png v2rayN.png
|
||||||
|
- install -Dm644 usr/lib/v2rayN/v2rayN.png usr/share/pixmaps/v2rayN.png
|
||||||
|
- cat > 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 v2rayN.desktop usr/share/applications/v2rayN.desktop
|
||||||
|
- cat > AppRun <<\EOF
|
||||||
|
- #!/bin/sh
|
||||||
|
- HERE="$(dirname "$(readlink -f "${0}")")"
|
||||||
|
- cd ${HERE}/usr/lib/v2rayN
|
||||||
|
- exec ${HERE}/usr/lib/v2rayN/v2rayN $@
|
||||||
|
- EOF
|
||||||
|
- chmod a+x AppRun
|
||||||
|
|
@ -582,9 +582,9 @@ public class Utils
|
||||||
if (host.StartsWith("#"))
|
if (host.StartsWith("#"))
|
||||||
continue;
|
continue;
|
||||||
var hostItem = host.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
|
var hostItem = host.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
if (hostItem.Length < 2)
|
if (hostItem.Length != 2)
|
||||||
continue;
|
continue;
|
||||||
systemHosts.Add(hostItem[1], hostItem[0]);
|
systemHosts.Add(hostItem.Last(), hostItem.First());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue