summaryrefslogtreecommitdiff
path: root/guix/scripts/download.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-11-07 23:29:45 +0100
committerLudovic Courtès <ludo@gnu.org>2016-11-07 23:39:01 +0100
commit64b8695cd8bbdca44dde226bde698489d68a44be (patch)
tree671e000a8a5d43dc71da0a806863f96424ffb39e /guix/scripts/download.scm
parentbc3c41ce36349ed4ec758c70b48a7059e363043a (diff)
downloadguix-patches-64b8695cd8bbdca44dde226bde698489d68a44be.tar
guix-patches-64b8695cd8bbdca44dde226bde698489d68a44be.tar.gz
guix download: Add '--no-check-certificate' option.
* guix/download.scm (download-to-store): Add #:verify-certificate? parameter and honor it. * guix/scripts/download.scm (%default-options): Add 'verify-certificate?' key. (show-help, %options): Add '--no-check-certificate'. (guix-download): Pass #:verify-certificate to 'download-to-store'. * doc/guix.texi (Invoking guix download): Document it.
Diffstat (limited to 'guix/scripts/download.scm')
-rw-r--r--guix/scripts/download.scm14
1 files changed, 12 insertions, 2 deletions
diff --git a/guix/scripts/download.scm b/guix/scripts/download.scm
index bcb4eaa043..ec30b05ac0 100644
--- a/guix/scripts/download.scm
+++ b/guix/scripts/download.scm
@@ -41,7 +41,8 @@
(define %default-options
;; Alist of default option values.
- `((format . ,bytevector->nix-base32-string)))
+ `((format . ,bytevector->nix-base32-string)
+ (verify-certificate? . #t)))
(define (show-help)
(display (_ "Usage: guix download [OPTION] URL
@@ -52,6 +53,9 @@ Supported formats: 'nix-base32' (default), 'base32', and 'base16'
('hex' and 'hexadecimal' can be used as well).\n"))
(format #t (_ "
-f, --format=FMT write the hash in the given format"))
+ (format #t (_ "
+ --no-check-certificate
+ do not validate the certificate of HTTPS servers "))
(newline)
(display (_ "
-h, --help display this help and exit"))
@@ -77,6 +81,9 @@ Supported formats: 'nix-base32' (default), 'base32', and 'base16'
(alist-cons 'format fmt-proc
(alist-delete 'format result))))
+ (option '("no-check-certificate") #f #f
+ (lambda (opt name arg result)
+ (alist-cons 'verify-certificate? #f result)))
(option '(#\h "help") #f #f
(lambda args
@@ -120,7 +127,10 @@ Supported formats: 'nix-base32' (default), 'base32', and 'base16'
(parameterize ((current-terminal-columns
(terminal-columns)))
(download-to-store store (uri->string uri)
- (basename (uri-path uri)))))))
+ (basename (uri-path uri))
+ #:verify-certificate?
+ (assoc-ref opts
+ 'verify-certificate?))))))
(hash (call-with-input-file
(or path
(leave (_ "~a: download failed~%")