| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 |
|
| 23 | (define-module (gnu installer)
|
| 24 | #:use-module (guix build utils)
|
| 25 | #:use-module (guix derivations)
|
| 26 | #:use-module (guix discovery)
|
| 27 | #:use-module (guix gexp)
|
| 28 | #:use-module (guix modules)
|
| 29 | #:use-module (guix monads)
|
| 30 | #:use-module (guix packages)
|
| 31 | #:use-module (guix store)
|
| 32 | #:use-module (guix utils)
|
| 33 | #:use-module (guix ui)
|
| 34 | #:use-module ((guix self) #:select (make-config.scm))
|
| 35 | #:use-module (guix describe)
|
| 36 | #:use-module (guix channels)
|
| 37 | #:use-module (guix packages)
|
| 38 | #:use-module (guix git-download)
|
| 39 | #:use-module (gnu installer utils)
|
| 40 | #:use-module (gnu packages admin)
|
| 41 | #:use-module (gnu packages base)
|
| 42 | #:use-module (gnu packages bash)
|
| 43 | #:use-module (gnu packages compression)
|
| 44 | #:use-module (gnu packages connman)
|
| 45 | #:use-module (gnu packages cryptsetup)
|
| 46 | #:use-module (gnu packages disk)
|
| 47 | #:use-module (gnu packages file-systems)
|
| 48 | #:use-module (gnu packages guile)
|
| 49 | #:use-module (gnu packages guile-xyz)
|
| 50 | #:autoload (gnu packages gnupg) (guile-gcrypt)
|
| 51 | #:use-module (gnu packages iso-codes)
|
| 52 | #:use-module (gnu packages linux)
|
| 53 | #:use-module (gnu packages ncurses)
|
| 54 | #:use-module (gnu packages package-management)
|
| 55 | #:use-module (gnu packages pciutils)
|
| 56 | #:use-module (gnu packages text-editors)
|
| 57 | #:use-module (gnu packages tls)
|
| 58 | #:use-module (gnu packages xorg)
|
| 59 | #:use-module (gnu system locale)
|
| 60 | #:use-module (ice-9 match)
|
| 61 | #:use-module (srfi srfi-1)
|
| 62 | #:use-module (web uri)
|
| 63 | #:export (installer-program
|
| 64 | installer-steps
|
| 65 | run-installer))
|
| 66 |
|
| 67 | (define module-to-import?
|
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | (match-lambda
|
| 73 | (('guix 'config) #f)
|
| 74 | (('gnu 'installer _ ...) #t)
|
| 75 | (('gnu 'build _ ...) #t)
|
| 76 | (('guix 'build _ ...) #t)
|
| 77 | (('guix 'read-print) #t)
|
| 78 | (_ #f)))
|
| 79 |
|
| 80 | (define not-config?
|
| 81 | |
| 82 | (match-lambda
|
| 83 | (('guix 'config) #f)
|
| 84 | (('guix _ ...) #t)
|
| 85 | (('gnu _ ...) #t)
|
| 86 | (_ #f)))
|
| 87 |
|
| 88 | (define* (build-compiled-file name locale-builder)
|
| 89 | "Return a file-like object that evaluates the gexp LOCALE-BUILDER and store
|
| 90 | its result in the scheme file NAME. The derivation will also build a compiled
|
| 91 | version of this file."
|
| 92 | (define set-utf8-locale
|
| 93 | #~(begin
|
| 94 | (setenv "LOCPATH"
|
| 95 | #$(file-append
|
| 96 | (libc-utf8-locales-for-target) "/lib/locale/"
|
| 97 | (version-major+minor
|
| 98 | (package-version (libc-utf8-locales-for-target)))))
|
| 99 | (setlocale LC_ALL "en_US.utf8")))
|
| 100 |
|
| 101 | (define builder
|
| 102 | (with-extensions (list guile-json-3)
|
| 103 | (with-imported-modules `(,@(source-module-closure
|
| 104 | '((gnu installer locale))
|
| 105 | #:select? not-config?)
|
| 106 | ((guix config) => ,(make-config.scm)))
|
| 107 | #~(begin
|
| 108 | (use-modules (gnu installer locale))
|
| 109 |
|
| 110 | |
| 111 | #$set-utf8-locale
|
| 112 |
|
| 113 | (mkdir #$output)
|
| 114 | (let ((locale-file
|
| 115 | (string-append #$output "/" #$name ".scm"))
|
| 116 | (locale-compiled-file
|
| 117 | (string-append #$output "/" #$name ".go")))
|
| 118 | (call-with-output-file locale-file
|
| 119 | (lambda (port)
|
| 120 | (write #$locale-builder port)))
|
| 121 | (compile-file locale-file
|
| 122 | #:output-file locale-compiled-file))))))
|
| 123 | (computed-file name builder))
|
| 124 |
|
| 125 | (define apply-locale
|
| 126 | |
| 127 | (with-imported-modules (source-module-closure '((gnu services herd)))
|
| 128 | #~(lambda (locale)
|
| 129 | (false-if-exception
|
| 130 | (setlocale LC_ALL locale))
|
| 131 |
|
| 132 | |
| 133 | |
| 134 | |
| 135 | (parameterize ((shepherd-message-port
|
| 136 | (%make-void-port "w")))
|
| 137 | (stop-service 'term-tty2)
|
| 138 | (start-service 'term-tty2 (list locale))))))
|
| 139 |
|
| 140 | (define* (compute-locale-step #:key
|
| 141 | locales-name
|
| 142 | iso639-languages-name
|
| 143 | iso3166-territories-name
|
| 144 | dry-run?)
|
| 145 | "Return a gexp that run the locale-page of INSTALLER, and install the
|
| 146 | selected locale. The list of locales, languages and territories passed to
|
| 147 | locale-page are computed in derivations named respectively LOCALES-NAME,
|
| 148 | ISO639-LANGUAGES-NAME and ISO3166-TERRITORIES-NAME. Those lists are compiled,
|
| 149 | so that when the installer is run, all the lengthy operations have already
|
| 150 | been performed at build time."
|
| 151 | (define (compiled-file-loader file name)
|
| 152 | #~(load-compiled
|
| 153 | (string-append #$file "/" #$name ".go")))
|
| 154 |
|
| 155 | (let* ((supported-locales #~(supported-locales->locales
|
| 156 | #+(glibc-supported-locales)))
|
| 157 |
|
| 158 | |
| 159 | |
| 160 | |
| 161 | (iso-codes #~(string-append #$iso-codes "/share/iso-codes/json/"))
|
| 162 | (iso639-3 #~(string-append #$iso-codes "iso_639-3.json"))
|
| 163 | (iso639-5 #~(string-append #$iso-codes "iso_639-5.json"))
|
| 164 | (iso3166 #~(string-append #$iso-codes "iso_3166-1.json"))
|
| 165 | (locales-file (build-compiled-file
|
| 166 | locales-name
|
| 167 | #~`(quote ,#$supported-locales)))
|
| 168 | (iso639-file (build-compiled-file
|
| 169 | iso639-languages-name
|
| 170 | #~`(quote ,(iso639->iso639-languages
|
| 171 | #$supported-locales
|
| 172 | #$iso639-3 #$iso639-5))))
|
| 173 | (iso3166-file (build-compiled-file
|
| 174 | iso3166-territories-name
|
| 175 | #~`(quote ,(iso3166->iso3166-territories #$iso3166))))
|
| 176 | (locales-loader (compiled-file-loader locales-file
|
| 177 | locales-name))
|
| 178 | (iso639-loader (compiled-file-loader iso639-file
|
| 179 | iso639-languages-name))
|
| 180 | (iso3166-loader (compiled-file-loader iso3166-file
|
| 181 | iso3166-territories-name)))
|
| 182 | #~(lambda (current-installer)
|
| 183 | (let ((result
|
| 184 | ((installer-locale-page current-installer)
|
| 185 | #:supported-locales #$locales-loader
|
| 186 | #:iso639-languages #$iso639-loader
|
| 187 | #:iso3166-territories #$iso3166-loader
|
| 188 | #:dry-run? #$dry-run?)))
|
| 189 | (if #$dry-run?
|
| 190 | '()
|
| 191 | (#$apply-locale result))
|
| 192 | result))))
|
| 193 |
|
| 194 | (define apply-keymap
|
| 195 | |
| 196 | #~(match-lambda
|
| 197 | ((layout variant options)
|
| 198 | (kmscon-update-keymap (default-keyboard-model)
|
| 199 | layout variant options))))
|
| 200 |
|
| 201 | (define (compute-keymap-step context dry-run?)
|
| 202 | "Return a gexp that runs the keymap-page of INSTALLER and install the
|
| 203 | selected keymap."
|
| 204 | #~(lambda (current-installer)
|
| 205 | (let ((result
|
| 206 | (call-with-values
|
| 207 | (lambda ()
|
| 208 | (xkb-rules->models+layouts
|
| 209 | (string-append #$xkeyboard-config
|
| 210 | "/share/X11/xkb/rules/base.xml")))
|
| 211 | (lambda (models layouts)
|
| 212 | ((installer-keymap-page current-installer)
|
| 213 | layouts '#$context #$dry-run?)))))
|
| 214 | (and result (#$apply-keymap result))
|
| 215 | result)))
|
| 216 |
|
| 217 | (define* (installer-steps #:key dry-run?)
|
| 218 | (let ((locale-step (compute-locale-step
|
| 219 | #:locales-name "locales"
|
| 220 | #:iso639-languages-name "iso639-languages"
|
| 221 | #:iso3166-territories-name "iso3166-territories"
|
| 222 | #:dry-run? dry-run?))
|
| 223 | (timezone-data #~(string-append #$tzdata
|
| 224 | "/share/zoneinfo/zone.tab")))
|
| 225 | #~(lambda (current-installer)
|
| 226 | ((installer-parameters-menu current-installer)
|
| 227 | (lambda ()
|
| 228 | ((installer-parameters-page current-installer)
|
| 229 | (lambda _
|
| 230 | (#$(compute-keymap-step 'param dry-run?)
|
| 231 | current-installer)))))
|
| 232 | (list
|
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | (installer-step
|
| 238 | (id 'locale)
|
| 239 | (description (G_ "Locale"))
|
| 240 | (compute (lambda _
|
| 241 | (#$locale-step current-installer)))
|
| 242 | (configuration-formatter locale->configuration))
|
| 243 |
|
| 244 | |
| 245 | |
| 246 | (installer-step
|
| 247 | (id 'welcome)
|
| 248 | (compute (lambda _
|
| 249 | ((installer-welcome-page current-installer)
|
| 250 | #$(local-file "installer/aux-files/logo.txt")
|
| 251 | #:pci-database
|
| 252 | #$(file-append pciutils "/share/hwdata/pci.ids.gz")))))
|
| 253 |
|
| 254 | |
| 255 | (installer-step
|
| 256 | (id 'timezone)
|
| 257 | (description (G_ "Timezone"))
|
| 258 | (compute (lambda _
|
| 259 | ((installer-timezone-page current-installer)
|
| 260 | #$timezone-data)))
|
| 261 | (configuration-formatter posix-tz->configuration))
|
| 262 |
|
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | (installer-step
|
| 273 | (id 'keymap)
|
| 274 | (description (G_ "Keyboard mapping selection"))
|
| 275 | (compute (lambda _
|
| 276 | (if #$dry-run?
|
| 277 | '("en" "US" #f)
|
| 278 | (#$(compute-keymap-step 'default dry-run?)
|
| 279 | current-installer))))
|
| 280 | (configuration-formatter keyboard-layout->configuration))
|
| 281 |
|
| 282 | |
| 283 | (installer-step
|
| 284 | (id 'hostname)
|
| 285 | (description (G_ "Hostname"))
|
| 286 | (compute (lambda _
|
| 287 | ((installer-hostname-page current-installer))))
|
| 288 | (configuration-formatter hostname->configuration))
|
| 289 |
|
| 290 | |
| 291 | |
| 292 | (installer-step
|
| 293 | (id 'network)
|
| 294 | (description (G_ "Network selection"))
|
| 295 | (compute (lambda _
|
| 296 | (if #$dry-run?
|
| 297 | '()
|
| 298 | ((installer-network-page current-installer))))))
|
| 299 |
|
| 300 | |
| 301 | (installer-step
|
| 302 | (id 'substitutes)
|
| 303 | (description (G_ "Substitute server discovery"))
|
| 304 | (compute (lambda _
|
| 305 | (if #$dry-run?
|
| 306 | '()
|
| 307 | ((installer-substitutes-page current-installer))))))
|
| 308 |
|
| 309 | |
| 310 | (installer-step
|
| 311 | (id 'user)
|
| 312 | (description (G_ "User creation"))
|
| 313 | (compute (lambda _
|
| 314 | ((installer-user-page current-installer))))
|
| 315 | (configuration-formatter users->configuration))
|
| 316 |
|
| 317 | |
| 318 | |
| 319 | (installer-step
|
| 320 | (id 'kernel)
|
| 321 | (description (G_ "Kernel"))
|
| 322 | (compute (lambda _
|
| 323 | (if (target-x86?)
|
| 324 | ((installer-kernel-page current-installer))
|
| 325 | '())))
|
| 326 | (configuration-formatter (lambda (result)
|
| 327 | (kernel->configuration result #$dry-run?))))
|
| 328 |
|
| 329 | |
| 330 | (installer-step
|
| 331 | (id 'services)
|
| 332 | (description (G_ "Services"))
|
| 333 | (compute (lambda _
|
| 334 | ((installer-services-page current-installer))))
|
| 335 | (configuration-formatter system-services->configuration))
|
| 336 |
|
| 337 | |
| 338 | |
| 339 | |
| 340 | |
| 341 | (installer-step
|
| 342 | (id 'partition)
|
| 343 | (description (G_ "Partitioning"))
|
| 344 | (compute (lambda _
|
| 345 | (if #$dry-run?
|
| 346 | '()
|
| 347 | ((installer-partitioning-page current-installer)))))
|
| 348 | (configuration-formatter user-partitions->configuration))
|
| 349 |
|
| 350 | (installer-step
|
| 351 | (id 'final)
|
| 352 | (description (G_ "Configuration file"))
|
| 353 | (compute
|
| 354 | (lambda (result prev-steps)
|
| 355 | ((installer-final-page current-installer)
|
| 356 | result prev-steps #$dry-run?))))))))
|
| 357 |
|
| 358 | (define (provenance-sexp)
|
| 359 | "Return an sexp representing the currently-used channels, for logging
|
| 360 | purposes."
|
| 361 | (match (match (current-channels)
|
| 362 | (() (and=> (repository->guix-channel (dirname (current-filename)))
|
| 363 | list))
|
| 364 | (channels channels))
|
| 365 | (#f
|
| 366 | (warning (G_ "cannot determine installer provenance~%"))
|
| 367 | 'unknown)
|
| 368 | ((channels ...)
|
| 369 | (map (lambda (channel)
|
| 370 | |
| 371 | |
| 372 | |
| 373 | `(channel ,(channel-name channel) ,(channel-commit channel)))
|
| 374 | channels))))
|
| 375 |
|
| 376 | (define* (installer-program #:key dry-run? (guix-for-installer (current-guix)))
|
| 377 | "Return a file-like object that runs the given INSTALLER."
|
| 378 | (define init-gettext
|
| 379 | |
| 380 | |
| 381 | #~(begin
|
| 382 | (bindtextdomain "guix" (string-append #$guix "/share/locale"))
|
| 383 | (textdomain "guix")
|
| 384 | (setlocale LC_ALL "")))
|
| 385 |
|
| 386 | (define set-installer-path
|
| 387 | |
| 388 | #~(let* ((inputs
|
| 389 | '#$(list bash |
| 390 | connman |
| 391 | cryptsetup
|
| 392 | dosfstools |
| 393 | e2fsprogs |
| 394 | lvm2-static |
| 395 | btrfs-progs
|
| 396 | jfsutils |
| 397 | ntfs-3g |
| 398 | xfsprogs |
| 399 | kbd |
| 400 | util-linux |
| 401 | nano
|
| 402 | shadow
|
| 403 | tar |
| 404 | gzip |
| 405 | coreutils)))
|
| 406 | (with-output-to-port (%make-void-port "w")
|
| 407 | (lambda ()
|
| 408 | (set-path-environment-variable "PATH" '("bin" "sbin") inputs)))))
|
| 409 |
|
| 410 | (define steps (installer-steps #:dry-run? dry-run?))
|
| 411 | (define modules
|
| 412 | (scheme-modules*
|
| 413 | (string-append (current-source-directory) "/..")
|
| 414 | "gnu/installer"))
|
| 415 |
|
| 416 | (define installer-builder
|
| 417 | |
| 418 | |
| 419 | (with-extensions (list guile-gcrypt guile-newt
|
| 420 | guile-parted guile-bytestructures
|
| 421 | guile-json-3 guile-git guile-webutils
|
| 422 | guile-gnutls
|
| 423 | guile-zlib |
| 424 | guile-zstd |
| 425 | guix-for-installer)
|
| 426 | (with-imported-modules `(,@(source-module-closure
|
| 427 | `(,@modules
|
| 428 | (gnu services herd)
|
| 429 | (guix build utils))
|
| 430 | #:select? module-to-import?)
|
| 431 | ((guix config) => ,(make-config.scm)))
|
| 432 | #~(begin
|
| 433 | (use-modules (gnu installer record)
|
| 434 | (gnu installer keymap)
|
| 435 | (gnu installer steps)
|
| 436 | (gnu installer dump)
|
| 437 | (gnu installer final)
|
| 438 | (gnu installer hostname)
|
| 439 | (gnu installer kernel)
|
| 440 | (gnu installer locale)
|
| 441 | (gnu installer parted)
|
| 442 | (gnu installer services)
|
| 443 | (gnu installer timezone)
|
| 444 | (gnu installer user)
|
| 445 | (gnu installer utils)
|
| 446 | (gnu installer newt)
|
| 447 | ((gnu installer newt keymap)
|
| 448 | #:select (keyboard-layout->configuration))
|
| 449 | (gnu services herd)
|
| 450 | (guix i18n)
|
| 451 | (guix build utils)
|
| 452 | (guix utils)
|
| 453 | ((system repl debug)
|
| 454 | #:select (terminal-width))
|
| 455 | (ice-9 match)
|
| 456 | (ice-9 textual-ports))
|
| 457 |
|
| 458 | |
| 459 | (setrlimit 'core #f #f)
|
| 460 | (unless #$dry-run?
|
| 461 | (call-with-output-file "/proc/sys/kernel/core_pattern"
|
| 462 | (lambda (port)
|
| 463 | (format port %core-dump))))
|
| 464 |
|
| 465 | |
| 466 | |
| 467 | #$init-gettext
|
| 468 |
|
| 469 | |
| 470 | #$set-installer-path
|
| 471 |
|
| 472 | |
| 473 | |
| 474 | |
| 475 | |
| 476 | |
| 477 | (bindtextdomain "iso_639-3" |
| 478 | #+(file-append iso-codes "/share/locale"))
|
| 479 | (bindtextdomain "iso_3166-1" |
| 480 | #+(file-append iso-codes "/share/locale"))
|
| 481 |
|
| 482 | |
| 483 | (bindtextdomain "xkeyboard-config"
|
| 484 | #+(file-append xkeyboard-config "/share/locale"))
|
| 485 |
|
| 486 | |
| 487 | |
| 488 | |
| 489 | (terminal-width 200)
|
| 490 |
|
| 491 | (define current-installer newt-installer)
|
| 492 | (define steps (#$steps current-installer))
|
| 493 |
|
| 494 | (installer-log-line "installer provenance: ~s"
|
| 495 | '#$(provenance-sexp))
|
| 496 |
|
| 497 | (dynamic-wind
|
| 498 | (installer-init current-installer)
|
| 499 | (lambda ()
|
| 500 | (parameterize
|
| 501 | ((%run-command-in-installer
|
| 502 | (if #$dry-run?
|
| 503 | dry-run-command
|
| 504 | (installer-run-command current-installer))))
|
| 505 | (catch #t
|
| 506 | (lambda ()
|
| 507 | (define results
|
| 508 | (run-installer-steps
|
| 509 | #:rewind-strategy 'menu
|
| 510 | #:menu-proc (installer-menu-page current-installer)
|
| 511 | #:steps steps
|
| 512 | #:dry-run? #$dry-run?))
|
| 513 |
|
| 514 | (let ((result (result-step results 'final)))
|
| 515 | (unless #$dry-run?
|
| 516 | (match (result-step results 'final)
|
| 517 | ('success
|
| 518 | |
| 519 | (sync)
|
| 520 | (stop-service 'root))
|
| 521 | (_
|
| 522 | |
| 523 | |
| 524 | #f)))))
|
| 525 | (const #f)
|
| 526 | (lambda (key . args)
|
| 527 | (installer-log-line "crashing due to uncaught exception: ~s ~s"
|
| 528 | key args)
|
| 529 | (define dump-dir
|
| 530 | (prepare-dump key args #:result %current-result))
|
| 531 |
|
| 532 | (define user-abort?
|
| 533 | (match args
|
| 534 | (((? user-abort-error? obj)) #t)
|
| 535 | (_ #f)))
|
| 536 |
|
| 537 | (define action
|
| 538 | (if user-abort?
|
| 539 | 'dump
|
| 540 | ((installer-exit-error current-installer)
|
| 541 | (get-string-all
|
| 542 | (open-input-file
|
| 543 | (string-append dump-dir
|
| 544 | "/installer-backtrace"))))))
|
| 545 |
|
| 546 | (match action
|
| 547 | ('dump
|
| 548 | (let* ((dump-files
|
| 549 | ((installer-dump-page current-installer)
|
| 550 | dump-dir))
|
| 551 | (dump-archive
|
| 552 | (make-dump dump-dir dump-files)))
|
| 553 | ((installer-report-page current-installer)
|
| 554 | dump-archive)))
|
| 555 | (_ #f))
|
| 556 | (exit 1)))))
|
| 557 |
|
| 558 | (installer-exit current-installer))))))
|
| 559 |
|
| 560 | (program-file
|
| 561 | "installer"
|
| 562 | #~(begin
|
| 563 | |
| 564 | |
| 565 | |
| 566 | (setenv "LANG" "en_US.UTF-8")
|
| 567 | (execl #$(program-file "installer-real" installer-builder
|
| 568 | #:guile guile-3.0-latest)
|
| 569 | "installer-real"))))
|
| 570 |
|
| 571 | (define* (installer-script #:key dry-run?
|
| 572 | (steps (installer-steps #:dry-run? dry-run?)))
|
| 573 | (program-file
|
| 574 | "installer-script"
|
| 575 | #~(begin
|
| 576 | (use-modules (gnu installer)
|
| 577 | (gnu installer record)
|
| 578 | (gnu installer keymap)
|
| 579 | (gnu installer steps)
|
| 580 | (gnu installer dump)
|
| 581 | (gnu installer final)
|
| 582 | (gnu installer hostname)
|
| 583 | (gnu installer kernel)
|
| 584 | (gnu installer locale)
|
| 585 | (gnu installer parted)
|
| 586 | (gnu installer services)
|
| 587 | (gnu installer timezone)
|
| 588 | (gnu installer user)
|
| 589 | (gnu installer utils)
|
| 590 | (gnu installer newt)
|
| 591 | ((gnu installer newt keymap)
|
| 592 | #:select (keyboard-layout->configuration))
|
| 593 | (gnu services herd)
|
| 594 | (guix i18n)
|
| 595 | (guix build utils)
|
| 596 | (guix utils)
|
| 597 | ((system repl debug)
|
| 598 | #:select (terminal-width))
|
| 599 | (ice-9 match)
|
| 600 | (ice-9 textual-ports))
|
| 601 | (terminal-width 200)
|
| 602 | (let* ((current-installer newt-installer)
|
| 603 | (steps (#$steps current-installer)))
|
| 604 | (catch #t
|
| 605 | (lambda _
|
| 606 | ((installer-init current-installer))
|
| 607 | (parameterize ((%run-command-in-installer
|
| 608 | (if #$dry-run?
|
| 609 | dry-run-command
|
| 610 | (installer-run-command current-installer)))
|
| 611 | (%installer-configuration-file
|
| 612 | (if #$dry-run?
|
| 613 | "config.scm"
|
| 614 | (%installer-configuration-file))))
|
| 615 | (let ((results (run-installer-steps
|
| 616 | #:rewind-strategy 'menu
|
| 617 | #:menu-proc
|
| 618 | (installer-menu-page current-installer)
|
| 619 | #:steps steps
|
| 620 | #:dry-run? #$dry-run?)))
|
| 621 | (result-step results 'final)
|
| 622 | ((installer-exit current-installer)))))
|
| 623 | (const #f)
|
| 624 | (lambda (key . args)
|
| 625 | (sleep 10)
|
| 626 | ((installer-exit current-installer))
|
| 627 | (display-backtrace (make-stack #t) (current-error-port))
|
| 628 | (apply throw key args)))))))
|
| 629 |
|
| 630 | (define* (run-installer #:key dry-run?)
|
| 631 | "To run the installer from Guile without building it:
|
| 632 | ./pre-inst-env guile -c '((@ (gnu installer) run-installer) #:dry-run? #t)'
|
| 633 | when using #:dry-run? #t, no root access is required and the LOCALE, KEYMAP,
|
| 634 | and PARTITION pages are skipped."
|
| 635 | (let* ((script (installer-script #:dry-run? dry-run?))
|
| 636 | (store (open-connection))
|
| 637 | (drv (run-with-store store
|
| 638 | (lower-object script)))
|
| 639 | (program (match (derivation->output-paths drv)
|
| 640 | ((("out" . program)) program)))
|
| 641 | (outputs (build-derivations store (list drv))))
|
| 642 | (close-connection store)
|
| 643 | (format #t "running installer: ~a\n" program)
|
| 644 | (invoke "guile" program)))
|