From 8ff5c7355f4888927575e42c177b527218dd2567 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Thu, 19 Sep 2019 12:35:18 +0200 Subject: [PATCH] gnu: Add makeself-safeextract. * gnu/packages/compression.scm (makeself-safeextract): New variable. --- gnu/packages/compression.scm | 50 +++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm index bda43bfd18..6771de3028 100644 --- a/gnu/packages/compression.scm +++ b/gnu/packages/compression.scm @@ -22,7 +22,7 @@ ;;; Copyright © 2017 Julien Lepiller ;;; Copyright © 2018 Rutger Helling ;;; Copyright © 2018 Joshua Sierles, Nextjournal -;;; Copyright © 2018 Pierre Neidhardt +;;; Copyright © 2018, 2019 Pierre Neidhardt ;;; Copyright © 2019 Nicolas Goaziou ;;; ;;; This file is part of GNU Guix. @@ -48,6 +48,7 @@ (define-module (gnu packages compression) #:use-module (guix git-download) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) + #:use-module (guix build-system trivial) #:use-module (gnu packages) #:use-module (gnu packages assembly) #:use-module (gnu packages autotools) @@ -2000,3 +2001,50 @@ (define-public zutils at run time, and must be installed separately.") (license (list license:bsd-2 ; arg_parser.{cc,h} license:gpl2+)))) ; the rest + +(define-public makeself-safeextract + (let ((commit "1a95e121fa8e3c02d307ae37b9b7834e616c3683")) + (package + (name "makeself-safeextract") + (version (git-version "0.0.0" "1" commit)) + (home-page "https://github.com/ssokolow/makeself_safeextract") + (source + (origin + (method git-fetch) + (uri (git-reference + (url home-page) + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1anlinaj9lvfi8bn00wp11vzqq0f9sig4fm9yrspisx31v0z4a2c")))) + (build-system trivial-build-system) + (inputs + `(("python" ,python-2) + ("p7zip" ,p7zip) + ("unzip" ,unzip))) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (let* ((name "makeself_safeextract") + (source (string-append (assoc-ref %build-inputs "source") + "/" name ".py")) + (bin (string-append (assoc-ref %outputs "out") "/bin")) + (target (string-append bin "/" name)) + (python (string-append (assoc-ref %build-inputs "python") "/bin")) + (7z (string-append (assoc-ref %build-inputs "p7zip") "/bin/7z")) + (unzip (string-append (assoc-ref %build-inputs "unzip") "/bin/unzip"))) + (setenv "PATH" (string-append (getenv "PATH") ":" python)) + (mkdir-p bin) + (copy-file source target) + (substitute* target + (("'7z'") (format #f "'~a'" 7z)) + (("'unzip'") (format #f "'~a'" unzip))) + (patch-shebang target))))) + (synopsis "Extract makeself and mojo archives without running untrusted code") + (description "This package provides a script to unpack self-extracting +archives generated by @command{makeself} or @command{mojo} without running the +possibly untrusted extraction shell script.") + (license license:gpl3+))))