Modify the build linux script and add release package deb

This commit is contained in:
2dust
2024-12-25 16:11:02 +08:00
parent b43975ebfc
commit 199d87ba84
3 changed files with 86 additions and 22 deletions

View File

@@ -1,18 +0,0 @@
#!/bin/sh
echo 'Building Linux'
OutputPath='./bin/v2rayN'
OutputPath64="${OutputPath}/linux-x64"
OutputPathArm64="${OutputPath}/linux-arm64"
dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r linux-x64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPath64
dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r linux-arm64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPathArm64
rm -rf "$OutputPath64/*.pdb"
rm -rf "$OutputPathArm64/*.pdb"
echo 'Build done'
7z a v2rayN-linux.zip $OutputPath
exit 0

51
v2rayN/package-debian.sh Normal file
View File

@@ -0,0 +1,51 @@
#!/bin/bash
version="$1"
arch="$2"
OutputPath="v2rayN-linux-${arch}"
mkdir -p "${OutputPath}/DEBIAN"
mkdir -p "${OutputPath}/opt"
cp -r "./bin/v2rayN/linux-${arch}" "${OutputPath}/opt"
mv "${OutputPath}/opt/linux-${arch}" "${OutputPath}/opt/v2rayN"
if [ $arch = "x64" ]; then
Arch2="amd64"
else
Arch2="arm64"
fi
echo $Arch2
# basic
cat >"${OutputPath}/DEBIAN/control" <<-EOF
Package: v2rayN
Version: $version
Architecture: $Arch2
Maintainer: https://github.com/2dust/v2rayN
Description: A GUI client for Windows and Linux, support Xray core and sing-box-core and others
EOF
cat >"${OutputPath}/DEBIAN/postinst" <<-EOF
if [ ! -s /usr/share/applications/v2rayN.desktop ]; then
cat >/usr/share/applications/v2rayN.desktop<<-END
[Desktop Entry]
Name=v2rayN
Comment=A GUI client for Windows and Linux, support Xray core and sing-box-core and others
Exec=/opt/v2rayN/v2rayN
Icon=/opt/v2rayN/v2rayN.png
Terminal=false
Type=Application
Categories=Network;Application;
END
fi
update-desktop-database
EOF
sudo chmod 0755 "${OutputPath}/DEBIAN/postinst"
sudo chmod 0755 "${OutputPath}/opt/v2rayN/v2rayN"
# desktop && PATH
sudo dpkg-deb -Zxz --build $OutputPath