2024-12-25 08:11:02 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-12-26 09:19:42 +00:00
|
|
|
Arch="$1"
|
|
|
|
OutputPath="$2"
|
|
|
|
Version="$3"
|
2024-12-25 08:11:02 +00:00
|
|
|
|
2025-01-18 13:10:41 +00:00
|
|
|
FileName="v2rayN-${Arch}.zip"
|
|
|
|
wget -nv -O $FileName "https://github.com/2dust/v2rayN-core-bin/raw/refs/heads/master/$FileName"
|
|
|
|
7z x $FileName
|
|
|
|
cp -rf v2rayN-${Arch}/* $OutputPath
|
|
|
|
|
2024-12-26 09:19:42 +00:00
|
|
|
PackagePath="v2rayN-Package-${Arch}"
|
|
|
|
mkdir -p "${PackagePath}/DEBIAN"
|
|
|
|
mkdir -p "${PackagePath}/opt"
|
|
|
|
cp -rf $OutputPath "${PackagePath}/opt/v2rayN"
|
2024-12-30 10:16:07 +00:00
|
|
|
echo "When this file exists, app will not store configs under this folder" > "${PackagePath}/opt/v2rayN/NotStoreConfigHere.txt"
|
2024-12-25 08:11:02 +00:00
|
|
|
|
2024-12-26 09:19:42 +00:00
|
|
|
if [ $Arch = "linux-64" ]; then
|
2024-12-25 08:11:02 +00:00
|
|
|
Arch2="amd64"
|
|
|
|
else
|
|
|
|
Arch2="arm64"
|
|
|
|
fi
|
|
|
|
echo $Arch2
|
|
|
|
|
|
|
|
# basic
|
2024-12-26 09:19:42 +00:00
|
|
|
cat >"${PackagePath}/DEBIAN/control" <<-EOF
|
2024-12-25 08:11:02 +00:00
|
|
|
Package: v2rayN
|
2024-12-26 09:19:42 +00:00
|
|
|
Version: $Version
|
2024-12-25 08:11:02 +00:00
|
|
|
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
|
|
|
|
|
2024-12-26 09:19:42 +00:00
|
|
|
cat >"${PackagePath}/DEBIAN/postinst" <<-EOF
|
2024-12-25 08:11:02 +00:00
|
|
|
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
|
|
|
|
|
2024-12-26 09:19:42 +00:00
|
|
|
sudo chmod 0755 "${PackagePath}/DEBIAN/postinst"
|
|
|
|
sudo chmod 0755 "${PackagePath}/opt/v2rayN/v2rayN"
|
2024-12-30 10:16:07 +00:00
|
|
|
sudo chmod 0755 "${PackagePath}/opt/v2rayN/AmazTool"
|
2024-12-25 08:11:02 +00:00
|
|
|
|
|
|
|
# desktop && PATH
|
|
|
|
|
2024-12-26 09:19:42 +00:00
|
|
|
sudo dpkg-deb -Zxz --build $PackagePath
|
|
|
|
sudo mv "${PackagePath}.deb" "v2rayN-${Arch}.deb"
|