Subject: [PATCH wip-harden-installer 14/14] installer: Add confirmation page when running external commands.

From: Josselin Poiret <[email-masked]>
Date: Thu, 6 Jan 2022 23:48:12 +0100

* gnu/installer/newt.scm (newt-run-command): Add it.
---
 gnu/installer/newt.scm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gnu/installer/newt.scm b/gnu/installer/newt.scm
index fc851339d1..4830667d4d 100644
--- a/gnu/installer/newt.scm
+++ b/gnu/installer/newt.scm
@@ -80,6 +80,16 @@ (define (exit-error file report key args)
   (clear-screen))
 
 (define (newt-run-command . args)
+  (define displayed-command
+    (string-join
+     (map (lambda (s) (string-append "\"" s "\"")) args)
+     " "))
+  (run-confirmation-page
+   (format #f "The installer will run the following command:~%~a~%"
+           displayed-command)
+   "External command"
+   #:exit-button-procedure (lambda ()
+                             (abort-to-prompt 'installer-step 'abort)))
   (newt-suspend)
   (clear-screen)
   (define result (run-command args))
-- 
2.34.0