guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 4ff634fb8f5caf49c6f011fe09e6e4cd3198968d
Author: Grigory Shepelev <[email protected]>
AuthorDate: Tue Jun 9 13:47:55 2026 +0300

    gnu: zapret2: Fix runtime dependencies and control-script paths.
    
    The init.d/sysv/zapret2 control script could not find its "functions"
    library
    (sourced relative to bin/ rather than libexec/zapret2):, defaulted
    ZAPRET_CONFIG to a read-only store path instead of /etc/zapret2/config,
    and the scripts call sed/grep/awk and coreutils that were absent from
    PATH at runtime (e.g. under shepherd).
    
    * gnu/packages/networking.scm (zapret2)[arguments]<#:phases>: Add
    'fix-zapret2-script phase setting ZAPRET_BASE, ZAPRET_CONFIG and the 
functions
    source path in the control script.  In 'wrap-scripts, add sed/grep/awk and
    coreutils to PATH for both scripts.
    [inputs]: Add coreutils, gawk, grep and sed.
    
    Merges: guix/guix!9191
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/packages/networking.scm | 35 +++++++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 6ef01d1c17..f3bec1efdd 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -5652,6 +5652,15 @@ WireGuard peer, and exposes a SOCKS5/HTTP proxy or 
tunnels on the machine.")
                 (("^MDIG=.*")
                  (string-append "MDIG="
                                 #$output "/libexec/zapret2/nfq2/mdig\n")))))
+          (add-after 'fix-blockcheck-file 'fix-zapret2-script
+            (lambda _
+              (substitute* "init.d/sysv/zapret2"
+                (("^ZAPRET_BASE=.*")
+                 (string-append "ZAPRET_BASE="
+                                #$output "/libexec/zapret2\n"
+                                "ZAPRET_CONFIG=/etc/zapret2/config\n"))
+                (("\\$EXEDIR/functions")
+                 (string-append #$output "/libexec/zapret2/functions")))))
           (replace 'install
             (lambda _
               (let ((bin (string-append #$output "/bin"))
@@ -5670,19 +5679,28 @@ WireGuard peer, and exposes a SOCKS5/HTTP proxy or 
tunnels on the machine.")
                            (string-append bin "/zapret2-blockcheck")))))
           (add-after 'install 'wrap-scripts
             (lambda* (#:key inputs #:allow-other-keys)
-              (wrap-program (string-append #$output "/bin/zapret2")
-                `("PATH" ":" prefix
-                  (,(dirname (search-input-file inputs "/sbin/nft")))))
-              (wrap-program (string-append #$output "/bin/zapret2-blockcheck")
-                `("PATH" ":" prefix
-                  (,(dirname (search-input-file inputs "/bin/curl"))
-                   ,(dirname (search-input-file inputs "/sbin/nft"))
-                   ,(dirname (search-input-file inputs 
"/bin/nslookup"))))))))))
+              ;; Tools expected at runtime.
+              (let* ((dir (lambda (f) (dirname (search-input-file inputs f))))
+                     (utils (list (dir "/bin/sed")
+                                  (dir "/bin/grep")
+                                  (dir "/bin/awk")
+                                  (dir "/bin/cut")
+                                  (dir "/sbin/nft"))))
+                (wrap-program (string-append #$output "/bin/zapret2")
+                  `("PATH" ":" prefix ,utils))
+                (wrap-program (string-append #$output 
"/bin/zapret2-blockcheck")
+                  `("PATH" ":" prefix
+                    (,(dir "/bin/curl")
+                     ,(dir "/bin/nslookup")
+                     ,@utils)))))))))
     (native-inputs
      (list pkg-config))
     (inputs
      (list bash-minimal
+           coreutils
            curl
+           gawk
+           grep
            `(,isc-bind "utils")
            libcap
            libmnl
@@ -5690,6 +5708,7 @@ WireGuard peer, and exposes a SOCKS5/HTTP proxy or 
tunnels on the machine.")
            libnfnetlink
            luajit
            nftables
+           sed
            zlib))
     (home-page "https://github.com/bol-van/zapret2";)
     (synopsis "DPI bypass platform configured in Lua")

Reply via email to