networkmanager-vpnc: clean up

This commit is contained in:
Jan Tojnar 2018-08-09 16:25:30 +02:00
parent bababf31c0
commit 7f175f2ad7
No known key found for this signature in database
GPG key ID: 7FAB2A15F7A607A4
2 changed files with 48 additions and 20 deletions

View file

@ -1,35 +1,32 @@
{ stdenv, fetchurl, vpnc, intltool, pkgconfig, networkmanager, libsecret { stdenv, fetchurl, substituteAll, vpnc, intltool, pkgconfig, networkmanager, libsecret
, withGnome ? true, gnome3, procps, kmod, file }: , withGnome ? true, gnome3, kmod, file }:
let let
pname = "NetworkManager-vpnc"; pname = "NetworkManager-vpnc";
version = "1.2.6"; version = "1.2.6";
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
name = "${pname}${if withGnome then "-gnome" else ""}-${version}"; name = "${pname}${if withGnome then "-gnome" else ""}-${version}";
src = fetchurl { src = fetchurl {
url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
sha256 = "1js5lwcsqws4klgypfxl4ikmakv7v7xgddij1fj6b0y0qicx0kyy"; sha256 = "1js5lwcsqws4klgypfxl4ikmakv7v7xgddij1fj6b0y0qicx0kyy";
}; };
buildInputs = [ vpnc networkmanager libsecret ] patches = [
++ stdenv.lib.optionals withGnome [ gnome3.gtk gnome3.libgnome-keyring (substituteAll {
gnome3.networkmanagerapplet ]; src = ./fix-paths.patch;
inherit vpnc kmod;
})
];
buildInputs = [ vpnc networkmanager ]
++ stdenv.lib.optionals withGnome [ gnome3.gtk libsecret gnome3.networkmanagerapplet ];
nativeBuildInputs = [ intltool pkgconfig file ]; nativeBuildInputs = [ intltool pkgconfig file ];
configureFlags = [ configureFlags = [
"${if withGnome then "--with-gnome --with-gtkver=3" else "--without-gnome"}" "--with-gnome=${if withGnome then "yes" else "no"}"
"--disable-static"
]; ];
preConfigure = ''
substituteInPlace "configure" \
--replace "/sbin/sysctl" "${procps}/bin/sysctl"
substituteInPlace "src/nm-vpnc-service.c" \
--replace "/sbin/vpnc" "${vpnc}/bin/vpnc" \
--replace "/sbin/modprobe" "${kmod}/bin/modprobe"
'';
passthru = { passthru = {
updateScript = gnome3.updateScript { updateScript = gnome3.updateScript {
packageName = pname; packageName = pname;
@ -37,9 +34,9 @@ in stdenv.mkDerivation rec {
}; };
}; };
meta = { meta = with stdenv.lib; {
description = "NetworkManager's VPNC plugin"; description = "NetworkManager's VPNC plugin";
inherit (networkmanager.meta) maintainers platforms; inherit (networkmanager.meta) maintainers platforms;
license = licenses.gpl2Plus;
}; };
} }

View file

@ -0,0 +1,31 @@
--- a/properties/nm-vpnc-editor-plugin.c
+++ b/properties/nm-vpnc-editor-plugin.c
@@ -161,7 +161,7 @@
GError *error = NULL;
const char *decrypt_possible_paths[] = {
- "/usr/lib/vpnc/cisco-decrypt",
+ "@vpnc@/bin/cisco-decrypt",
"/usr/bin/cisco-decrypt",
NULL
};
--- a/src/nm-vpnc-service.c
+++ b/src/nm-vpnc-service.c
@@ -610,7 +610,7 @@
find_vpnc (void)
{
static const char *vpnc_paths[] = {
- "/usr/sbin/vpnc",
+ "@vpnc@/bin/vpnc",
"/sbin/vpnc",
"/usr/local/sbin/vpnc",
NULL
@@ -1308,7 +1308,7 @@
_LOGD (" vpnc interactive mode is %s", interactive_available ? "enabled" : "disabled");
_LOGD (" uses%s --bus-name \"%s\"", bus_name_free ? "" : " default", bus_name);
- if (system ("/sbin/modprobe tun") == -1)
+ if (system ("@kmod@/bin/modprobe tun") == -1)
exit (EXIT_FAILURE);
plugin = nm_vpnc_plugin_new (bus_name);