amnezia-vpn: 4.8.2.3 -> 4.8.3.1 (#374131)

This commit is contained in:
Seth Flynn
2025-01-31 15:34:49 -05:00
committed by GitHub
2 changed files with 19 additions and 72 deletions
+19 -18
View File
@@ -7,7 +7,6 @@
kdePackages,
qt6,
libsecret,
xdg-utils,
amneziawg-go,
openvpn,
shadowsocks-rust,
@@ -20,6 +19,7 @@
zlib,
tun2socks,
xray,
nix-update-script,
}:
let
amnezia-tun2socks = tun2socks.overrideAttrs (
@@ -35,13 +35,6 @@ let
};
vendorHash = "sha256-VvOaTJ6dBFlbGZGxnHy2sCtds1tyhu6VsPewYpsDBiM=";
ldflags = [
"-w"
"-s"
"-X github.com/amnezia-vpn/amnezia-tun2socks/v2/internal/version.Version=v${finalAttrs.version}"
"-X github.com/amnezia-vpn/amnezia-tun2socks/v2/internal/version.GitCommit=v${finalAttrs.version}"
];
}
);
@@ -63,18 +56,16 @@ let
in
stdenv.mkDerivation (finalAttrs: {
pname = "amnezia-vpn";
version = "4.8.2.3";
version = "4.8.3.1";
src = fetchFromGitHub {
owner = "amnezia-vpn";
repo = "amnezia-client";
tag = finalAttrs.version;
hash = "sha256-bCWPyRW2xnnopcwfPHgQrdP85Ct0CDufJRQ1PvCAiDE=";
hash = "sha256-U/fVO9GcSdxFg5r57vX5Ylgu6CMjG4GKyInIgBNUiEw=";
fetchSubmodules = true;
};
patches = [ ./router.patch ];
postPatch =
''
substituteInPlace client/platforms/linux/daemon/wireguardutilslinux.cpp \
@@ -82,8 +73,7 @@ stdenv.mkDerivation (finalAttrs: {
substituteInPlace client/utilities.cpp \
--replace-fail 'return Utils::executable("../../client/bin/openvpn", true);' 'return Utils::executable("${openvpn}/bin/openvpn", false);' \
--replace-fail 'return Utils::executable("../../client/bin/tun2socks", true);' 'return Utils::executable("${amnezia-tun2socks}/bin/amnezia-tun2socks", false);' \
--replace-fail 'return Utils::usrExecutable("wg-quick");' 'return Utils::executable("${wireguard-tools}/bin/wg-quick", false);' \
--replace-fail 'QProcess::execute(QString("pkill %1").arg(name));' 'return QProcess::execute(QString("pkill -f %1").arg(name)) == 0;'
--replace-fail 'return Utils::usrExecutable("wg-quick");' 'return Utils::executable("${wireguard-tools}/bin/wg-quick", false);'
substituteInPlace client/protocols/xrayprotocol.cpp \
--replace-fail 'return Utils::executable(QString("xray"), true);' 'return Utils::executable(QString("${amnezia-xray}/bin/xray"), false);'
substituteInPlace client/protocols/openvpnovercloakprotocol.cpp \
@@ -91,11 +81,10 @@ stdenv.mkDerivation (finalAttrs: {
substituteInPlace client/protocols/shadowsocksvpnprotocol.cpp \
--replace-fail 'return Utils::executable(QString("/ss-local"), true);' 'return Utils::executable(QString("${shadowsocks-rust}/bin/sslocal"), false);'
substituteInPlace client/configurators/openvpn_configurator.cpp \
--replace-fail ".arg(qApp->applicationDirPath());" ".arg(\"$out/local/bin\");"
--replace-fail ".arg(qApp->applicationDirPath());" ".arg(\"$out/libexec\");"
substituteInPlace client/ui/qautostart.cpp \
--replace-fail "/usr/share/pixmaps/AmneziaVPN.png" "$out/share/pixmaps/AmneziaVPN.png"
substituteInPlace deploy/installer/config/AmneziaVPN.desktop.in \
--replace-fail "#!/usr/bin/env xdg-open" "#!${xdg-utils}/bin/xdg-open" \
--replace-fail "/usr/share/pixmaps/AmneziaVPN.png" "$out/share/pixmaps/AmneziaVPN.png"
substituteInPlace deploy/data/linux/AmneziaVPN.service \
--replace-fail "ExecStart=/opt/AmneziaVPN/service/AmneziaVPN-service.sh" "ExecStart=$out/bin/AmneziaVPN-service" \
@@ -137,14 +126,26 @@ stdenv.mkDerivation (finalAttrs: {
];
postInstall = ''
mkdir -p $out/bin $out/local/bin $out/share/applications $out/share/pixmaps $out/lib/systemd/system
mkdir -p $out/bin $out/libexec $out/share/applications $out/share/pixmaps $out/lib/systemd/system
cp client/AmneziaVPN service/server/AmneziaVPN-service $out/bin/
cp ../deploy/data/linux/client/bin/update-resolv-conf.sh $out/local/bin/
cp ../deploy/data/linux/client/bin/update-resolv-conf.sh $out/libexec/
cp ../AppDir/AmneziaVPN.desktop $out/share/applications/
cp ../deploy/data/linux/AmneziaVPN.png $out/share/pixmaps/
cp ../deploy/data/linux/AmneziaVPN.service $out/lib/systemd/system/
'';
passthru = {
inherit amnezia-tun2socks amnezia-xray;
updateScript = nix-update-script {
extraArgs = [
"--subpackage"
"amnezia-tun2socks"
"--subpackage"
"amnezia-xray"
];
};
};
meta = with lib; {
description = "Amnezia VPN Client";
downloadPage = "https://amnezia.org/en/downloads";
-54
View File
@@ -1,54 +0,0 @@
--- a/service/server/router_linux.cpp 2025-01-01 11:36:27.615658613 +0300
+++ b/service/server/router_linux.cpp 2025-01-01 18:07:57.300178080 +0300
@@ -19,9 +19,27 @@
#include <stdio.h>
#include <unistd.h>
#include <QFileInfo>
+#include <QStringList>
+#include <QString>
#include <core/networkUtilities.h>
+bool isServiceActive(const QString &serviceName) {
+ QProcess process;
+ process.start("systemctl", { "list-units", "--type=service", "--state=running", "--no-legend" });
+ process.waitForFinished();
+
+ QString output = process.readAllStandardOutput();
+ QStringList services = output.split('\n', Qt::SkipEmptyParts);
+
+ for (const QString &service : services) {
+ if (service.contains(serviceName)) {
+ return true;
+ }
+ }
+ return false;
+}
+
RouterLinux &RouterLinux::Instance()
{
static RouterLinux s;
@@ -158,15 +176,14 @@
p.setProcessChannelMode(QProcess::MergedChannels);
//check what the dns manager use
- if (QFileInfo::exists("/usr/bin/nscd")
- || QFileInfo::exists("/usr/sbin/nscd")
- || QFileInfo::exists("/usr/lib/systemd/system/nscd.service"))
- {
- p.start("systemctl restart nscd");
- }
- else
- {
- p.start("systemctl restart systemd-resolved");
+ if (isServiceActive("nscd.service")) {
+ qDebug() << "Restarting nscd.service";
+ p.start("systemctl", { "restart", "nscd" });
+ } else if (isServiceActive("systemd-resolved.service")) {
+ qDebug() << "Restarting systemd-resolved.service";
+ p.start("systemctl", { "restart", "systemd-resolved" });
+ } else {
+ qDebug() << "No suitable DNS manager found.";
}
p.waitForFinished();