Skip to content

Commit

Permalink
network-manager: fix paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jtojnar authored and worldofpeace committed Jan 2, 2019
1 parent be14e9f commit f748cc8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 23 deletions.
18 changes: 3 additions & 15 deletions pkgs/tools/networking/network-manager/default.nix
@@ -1,4 +1,4 @@
{ stdenv, fetchurl, fetchpatch, substituteAll, intltool, pkgconfig, dbus-glib
{ stdenv, fetchurl, substituteAll, intltool, pkgconfig, dbus, dbus-glib
, gnome3, systemd, libuuid, polkit, gnutls, ppp, dhcp, iptables
, libgcrypt, dnsmasq, bluez5, readline
, gobject-introspection, modemmanager, openresolv, libndp, newt, libsoup
Expand All @@ -25,14 +25,6 @@ in stdenv.mkDerivation rec {
preConfigure = ''
substituteInPlace configure --replace /usr/bin/uname ${coreutils}/bin/uname
substituteInPlace configure --replace /usr/bin/file ${file}/bin/file
substituteInPlace data/84-nm-drivers.rules \
--replace /bin/sh ${stdenv.shell}
substituteInPlace data/85-nm-unmanaged.rules \
--replace /bin/sh ${stdenv.shell} \
--replace /usr/sbin/ethtool ${ethtool}/sbin/ethtool \
--replace /bin/sed ${gnused}/bin/sed
substituteInPlace data/NetworkManager.service.in \
--replace /bin/kill ${coreutils}/bin/kill
# to enable link-local connections
configureFlags="$configureFlags --with-udev-dir=$out/lib/udev"
Expand Down Expand Up @@ -66,14 +58,10 @@ in stdenv.mkDerivation rec {
];

patches = [
# https://bugzilla.gnome.org/show_bug.cgi?id=796751
(fetchpatch {
url = https://bugzilla.gnome.org/attachment.cgi?id=372953;
sha256 = "0xg7bzs6dvkbv2qp67i7mi1c5yrmfd471xgmlkn15b33pqkzy3mc";
})
(substituteAll {
src = ./fix-paths.patch;
inherit inetutils kmod openconnect;
inherit inetutils kmod openconnect ethtool coreutils dbus;
inherit (stdenv) shell;
})

];
Expand Down
51 changes: 43 additions & 8 deletions pkgs/tools/networking/network-manager/fix-paths.patch
@@ -1,17 +1,52 @@
--- a/clients/common/nm-vpn-helpers.c
+++ b/clients/common/nm-vpn-helpers.c
@@ -205,7 +205,7 @@
char *argv[4];
const char *path;
@@ -214,10 +214,7 @@
NULL,
};

- path = nm_utils_find_helper ("openconnect", "/usr/sbin/openconnect", error);
- path = nm_utils_file_search_in_paths ("openconnect", "/usr/sbin/openconnect", DEFAULT_PATHS,
- G_FILE_TEST_IS_EXECUTABLE, NULL, NULL, error);
- if (!path)
- return FALSE;
+ path = "@openconnect@/bin/openconnect";
if (!path)
return FALSE;

argv[0] = (char *) path;
argv[1] = "--authenticate";
--- a/data/84-nm-drivers.rules
+++ b/data/84-nm-drivers.rules
@@ -7,6 +7,6 @@
# Determine ID_NET_DRIVER if there's no ID_NET_DRIVER or DRIVERS (old udev?)
ENV{ID_NET_DRIVER}=="?*", GOTO="nm_drivers_end"
DRIVERS=="?*", GOTO="nm_drivers_end"
-PROGRAM="/bin/sh -c 'ethtool -i $1 | sed -n s/^driver:\ //p' -- $env{INTERFACE}", RESULT=="?*", ENV{ID_NET_DRIVER}="%c"
+PROGRAM="@shell@ -c '@ethtool@/bin/ethtool -i $1 | @coreutils@/bin/sed -n s/^driver:\ //p' -- $env{INTERFACE}", RESULT=="?*", ENV{ID_NET_DRIVER}="%c"

LABEL="nm_drivers_end"
--- a/data/90-nm-thunderbolt.rules
+++ b/data/90-nm-thunderbolt.rules
@@ -5,7 +5,7 @@

# Load he thunderbolt-net driver if we a device of type thunderbolt_xdomain
# is added.
-SUBSYSTEM=="thunderbolt", ENV{DEVTYPE}=="thunderbolt_xdomain", RUN{builtin}+="kmod load thunderbolt-net"
+SUBSYSTEM=="thunderbolt", ENV{DEVTYPE}=="thunderbolt_xdomain", RUN{builtin}+="@kmod@/bin/kmod load thunderbolt-net"

# For all thunderbolt network devices, we want to enable link-local configuration
SUBSYSTEM=="net", ENV{ID_NET_DRIVER}=="thunderbolt-net", ENV{NM_AUTO_DEFAULT_LINK_LOCAL_ONLY}="1"
--- a/data/NetworkManager.service.in
+++ b/data/NetworkManager.service.in
@@ -8,7 +8,7 @@
[Service]
Type=dbus
BusName=org.freedesktop.NetworkManager
-ExecReload=/usr/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager.Reload uint32:0
+ExecReload=@dbus@/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager.Reload uint32:0
#ExecReload=/bin/kill -HUP $MAINPID
ExecStart=@sbindir@/NetworkManager --no-daemon
Restart=on-failure
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -11828,14 +11828,14 @@
@@ -12350,14 +12350,14 @@
gw = nm_ip4_config_best_default_route_get (priv->ip_config_4);
if (gw) {
nm_utils_inet4_ntop (NMP_OBJECT_CAST_IP4_ROUTE (gw)->gateway, buf);
Expand All @@ -30,7 +65,7 @@
}
--- a/src/nm-core-utils.c
+++ b/src/nm-core-utils.c
@@ -428,7 +428,7 @@
@@ -421,7 +421,7 @@

/* construct the argument list */
argv = g_ptr_array_sized_new (4);
Expand Down

0 comments on commit f748cc8

Please sign in to comment.