network-manager/l2tp: replace patch by substitutions to simplify upgrades

obadz b7731e44 9191f09c

+17 -44
-26
pkgs/tools/networking/network-manager/l2tp-purity.patch
··· 1 - diff --git a/src/nm-l2tp-service.c b/src/nm-l2tp-service.c 2 - index d2c9dc4..e61d3d2 100644 3 - --- a/src/nm-l2tp-service.c 4 - +++ b/src/nm-l2tp-service.c 5 - @@ -655,9 +655,7 @@ nm_find_ipsec (void) 6 - { 7 - static const char *ipsec_binary_paths[] = 8 - { 9 - - "/sbin/ipsec", 10 - - "/usr/sbin/ipsec", 11 - - "/usr/local/sbin/ipsec", 12 - + "@strongswan@/bin/ipsec", 13 - NULL 14 - }; 15 - 16 - @@ -677,9 +675,7 @@ nm_find_l2tpd (void) 17 - { 18 - static const char *l2tp_binary_paths[] = 19 - { 20 - - "/sbin/xl2tpd", 21 - - "/usr/sbin/xl2tpd", 22 - - "/usr/local/sbin/xl2tpd", 23 - + "@xl2tpd@/bin/xl2tpd", 24 - NULL 25 - }; 26 -
+17 -18
pkgs/tools/networking/network-manager/l2tp.nix
··· 1 - { stdenv, fetchFromGitHub, substituteAll, automake, autoconf, libtool, intltool, pkgconfig 1 + { stdenv, fetchFromGitHub, automake, autoconf, libtool, intltool, pkgconfig 2 2 , networkmanager, ppp, xl2tpd, strongswan 3 3 , withGnome ? true, gnome3 }: 4 4 ··· 8 8 version = "0.9.8.7"; 9 9 10 10 src = fetchFromGitHub { 11 - owner = "seriyps"; 12 - repo = "NetworkManager-l2tp"; 13 - rev = version; 11 + owner = "seriyps"; 12 + repo = "NetworkManager-l2tp"; 13 + rev = version; 14 14 sha256 = "07gl562p3f6l2wn64f3vvz1ygp3hsfhiwh4sn04c3fahfdys69zx"; 15 15 }; 16 16 ··· 19 19 20 20 nativeBuildInputs = [ automake autoconf libtool intltool pkgconfig ]; 21 21 22 - configureScript = "./autogen.sh"; 22 + postPatch = '' 23 + sed -i -e 's%"\(/usr/sbin\|/usr/pkg/sbin\|/usr/local/sbin\)/[^"]*",%%g' ./src/nm-l2tp-service.c 24 + 25 + substituteInPlace ./src/nm-l2tp-service.c \ 26 + --replace /sbin/ipsec ${strongswan}/bin/ipsec \ 27 + --replace /sbin/xl2tpd ${xl2tpd}/bin/xl2tpd 28 + 29 + # Workaround https://github.com/xelerance/xl2tpd/issues/108 30 + substituteInPlace ./src/nm-l2tp-service.c --replace 'write_config_option (pppopt_fd, "lock\n");' "" 31 + ''; 32 + 33 + preConfigure = "./autogen.sh"; 23 34 24 35 configureFlags = 25 36 if withGnome then "--with-gnome" else "--without-gnome"; 26 37 27 38 postConfigure = "sed 's/-Werror//g' -i Makefile */Makefile"; 28 39 29 - patches = 30 - [ ( substituteAll { 31 - src = ./l2tp-purity.patch; 32 - inherit xl2tpd strongswan; 33 - }) 34 - ]; 35 - 36 - # Workaround https://github.com/xelerance/xl2tpd/issues/108 37 - postPatch = '' 38 - substituteInPlace ./src/nm-l2tp-service.c --replace 'write_config_option (pppopt_fd, "lock\n");' "" 39 - ''; 40 - 41 40 meta = with stdenv.lib; { 42 41 description = "L2TP plugin for NetworkManager"; 43 42 inherit (networkmanager.meta) platforms; 44 43 homepage = https://github.com/seriyps/NetworkManager-l2tp; 45 44 license = licenses.gpl2; 46 - maintainers = with maintainers; [ abbradar ]; 45 + maintainers = with maintainers; [ abbradar obadz ]; 47 46 }; 48 47 }