Commit graph

22 commits

Author SHA1 Message Date
Ludovic Courtès 591af24ade
installer: Print progress bars and such as soon as \r is read.
Fixes <https://issues.guix.gnu.org/59922>.

Previously progress bars and related things would be buffered by
'run-external-command-with-line-hooks' until \n is read.

* gnu/installer/utils.scm (run-external-command-with-line-hooks): Use
'read-delimited' rather than 'get-line'.  Pass 'concat as the last
argument.
(%display-line-hook): Remove.
(run-command): Use 'display' instead of '%display-line-hook'.
(%syslog-line-hook): Add "\n" when LINE doesn't end in \n.
(%installer-log-line-hook): Do not add an extra newline.
(installer-log-line): Add an extra newline.
2022-12-09 17:49:22 +01:00
Mathieu Othacehe 96bb00d203
installer: Run the "guix system init" command in a PTY.
Fixes: <https://issues.guix.gnu.org/55360>

* gnu/installer/utils.scm (run-external-command-with-handler/tty): New
procedure.
(run-external-command-with-line-hooks, run-command): Add a TTY? argument.
* gnu/installer/final.scm (install-system): Call run-command with TTY?
argument set to #true.
2022-10-20 10:50:50 +02:00
Josselin Poiret 4814ec284f
installer: Move <secret> to utils and use it for crypt passwords.
* gnu/installer/user.scm (<secret>, secret?, make-secret, secret-content): Move
to utils.scm.
* gnu/installer/utils.scm (<secret>, secret?, make-secret, secret-content):
Moved from user.scm.
* gnu/installer/newt/partition.scm (prompt-luks-passwords): Make password a
<secret>.
* gnu/installer/parted.scm (luks-format-and-open): Unwrap secret.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-09-22 16:00:29 +02:00
Josselin Poiret 408427a36c
installer: Add installer-specific run command process.
* gnu/installer/record.scm (installer)[run-command]: Add field.
* gnu/installer/utils.scm (run-command-in-installer): Add parameter.
* gnu/installer.scm (installer-program): Parameterize
run-command-in-installer with current installer's run-command.
* gnu/installer/newt.scm (newt-run-command): New variable.
(newt-installer): Use it.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-02-02 16:46:43 +01:00
Josselin Poiret 0b9fbbb4dd
installer: Capture external commands output.
* gnu/installer/utils.scm (run-external-command-with-handler,
run-external-command-with-line-hooks): New variables.
(run-command): Use run-external-command-with-line-hooks.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-02-02 16:46:43 +01:00
Josselin Poiret 438bf9b840
installer: Un-export syslog syntax.
* gnu/installer/utils.scm (syslog): Remove export.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-02-02 16:46:43 +01:00
Josselin Poiret 4f2fd33b4f
installer: Use new installer-log-line everywhere.
* gnu/installer.scm (installer-program)
* gnu/installer/final.scm (install-locale)
* gnu/installer/newt.scm (init)
* gnu/installer/newt/final.scm (run-final-page)
* gnu/installer/newt/page.scm (run-form-with-clients)
* gnu/installer/newt/partition.scm (run-partitioning-page)
* gnu/installer/parted.scm (eligible-devices, mkpart,
luks-format-and-open, luks-close, mount-user-partitions,
umount-user-partitions, free-parted):
* gnu/installer/steps.scm (run-installer-steps):
* gnu/installer/utils.scm (run-command, send-to-clients): Use it.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-02-02 16:46:43 +01:00
Josselin Poiret 7251b15d30
installer: Generalize logging facility.
* gnu/installer/utils.scm (%syslog-line-hook, open-new-log-port,
installer-log-port, %installer-log-line-hook, %display-line-hook,
%default-installer-line-hooks, installer-log-line): Add new
variables.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-02-02 16:46:43 +01:00
Mathieu Othacehe 0c9693d8b3
installer: Do not set the locale in run-command.
Installing the locale inside the container, once the cow-store is mounted,
causes the process to keep opened locale files that can later prevent the
cow-store umount.

* gnu/installer/utils.scm (run-command): Remove locale argument.
* gnu/installer/final.scm (install-system): Adapt it.
2022-01-14 14:29:15 +01:00
Mathieu Othacehe 8361817bf6
install: Discover local substitute servers.
* gnu/installer/substitutes.scm: New file.
* gnu/installer/newt/substitutes.scm: New file.
* gnu/local.mk (INSTALLER_MODULES): Add them.
* po/guix/POTFILES.in: Add gnu/installer/newt/substitutes.scm.
* gnu/installer/proxy.scm (with-silent-shepherd): Move to ...
* gnu/installer/utils.scm: ... here.
* gnu/installer/record.scm (<installer>)[substitutes-page]: New field.
* gnu/installer/newt.scm (substitutes-page): New procedure,
(newt-installer): register it.
* gnu/installer.scm (installer-steps): Add "substitutes-page" step.
* gnu/system/install.scm (%installation-services): Add avahi-service-type and
enable substitute server discover in guix-service-type.
[<name-service-switch>]: Set it to %mdns-host-lookup-nss.
2020-12-11 21:37:07 +01:00
Mathieu Othacehe 3d3ffb30f9
installer: Fix device synchronization.
Reported by Florian Pelz:
https://lists.gnu.org/archive/html/guix-devel/2020-11/msg00326.html.

* gnu/installer/utils.scm (call-with-time): New procedure,
(let/time): new macro.
* gnu/installer/parted.scm (with-delay-device-in-use?): Increase the retry
count to 16.
(non-install-devices): Remove the call to with-delay-device-in-use? as it
doesn't return the expected result, and would block much longer now.
(free-parted): Log the time required to sync each device.
2020-11-17 19:10:14 +01:00
Mathieu Othacehe 5f7c4416b5
Revert "installer: utils: Dump command output to syslog when testing."
This reverts commit f73ed55791. This was pushed
by error, as this is not reviewed yet.
2020-06-09 10:33:04 +02:00
Mathieu Othacehe f73ed55791
installer: utils: Dump command output to syslog when testing.
When debugging the installation tests, it can be very handy to be able to read
"run-command" output, for instance when executing "guix system init".

Introduce a new "invoke-with-log" procedure that is able to log a command
standard and error outputs to the syslog. Use it, only when running the
installation tests, to dump "run-command" output.

* gnu/installer/utils.scm (open-pipe-with-stderr, invoke-with-log): New
procedures,
(invoke-log-port): new variable,
(run-command): move to the end of the file and use invoke-with-log when
running the installation tests.
2020-06-09 10:32:19 +02:00
Mathieu Othacehe 1a24df4434
gnu: installer: Fix issue with "Esperanto" locale.
According to glibc manual, locale are under the following form:
          language[_territory[.codeset]][@modifier]

The esperanto locale "epo" does not have a territory. Modify run-command to
take this into account.

Reported by Alex Sassmannshausen here:
https://lists.gnu.org/archive/html/guix-devel/2020-04/msg00192.html.

* gnu/installer/utils.scm (run-command): Handle locale without territory such
as "epo".
2020-04-10 15:50:44 +02:00
Ludovic Courtès 8a4b11c6a9
installer: Run commands without hopping through the shell.
* gnu/installer/utils.scm (run-shell-command): Rename to...
(run-command): Remove call to 'call-with-temporary-output-file' and hop
through Bash.  Expect COMMAND to be a list of strings rather than a
string.
* gnu/installer/final.scm (install-system): Turn INSTALL-COMMAND into a
list of strings and pass it to 'run-command'.
* gnu/installer/newt/page.scm (edit-file): Likewise.
2020-03-05 23:40:23 +01:00
Ludovic Courtès 63b8c089c1
installer: Implement a dialog on /var/guix/installer-socket.
This will allow us to automate testing of the installer.

* gnu/installer/utils.scm (%client-socket-file)
(current-server-socket, current-clients): New variables.
(open-server-socket, call-with-server-socket): New procedure.
(with-server-socket): New macro.
(run-shell-command): Add call to 'send-to-clients'.  Select on both
current-input-port and current-clients.
* gnu/installer/steps.scm (run-installer-steps): Wrap 'call-with-prompt'
in 'with-socket-server'.  Call 'sigaction' for SIGPIPE.
* gnu/installer/newt/page.scm (watch-clients!, close-port-and-reuse-fd)
(run-form-with-clients, send-to-clients): New procedures.
(draw-info-page): Add call to 'run-form-with-clients'.
(run-input-page): Likewise.  Handle EXIT-REASON equal to 'exit-fd-ready.
(run-confirmation-page): Likewise.
(run-listbox-selection-page): Likewise.  Define 'choice->item' and use it.
(run-checkbox-tree-page): Likewise.
(run-file-textbox-page): Add call to 'run-form-with-clients'.  Handle
'exit-fd-ready'.
* gnu/installer/newt/partition.scm (run-disk-page): Pass
 #:client-callback-procedure to 'run-listbox-selection-page'.
* gnu/installer/newt/user.scm (run-user-page): Call
'run-form-with-clients'.  Handle 'exit-fd-ready'.
* gnu/installer/newt/welcome.scm (run-menu-page): Define
'choice->item' and use it.  Call 'run-form-with-clients'.
* gnu/installer/newt/final.scm (run-install-success-page)
(run-install-failed-page): When (current-clients) is non-empty, call
'send-to-clients' without displaying a choice window.
2020-03-05 23:40:22 +01:00
Ludovic Courtès 5c04b00cf4
installer: Log important bits to syslog.
* gnu/installer.scm (installer-program): Log crashes with 'syslog'.
* gnu/installer/parted.scm (luks-format-and-open, luks-close)
(mount-user-partitions, umount-user-partitions): Add 'syslog' calls.
* gnu/installer/steps.scm (run-installer-steps): Log the running step
with 'syslog'.
* gnu/installer/utils.scm (run-shell-command): Add calls to 'syslog'.
2020-02-22 00:45:42 +01:00
Ludovic Courtès 2cf65e1d54
installer: Add 'syslog' macro to write to syslog.
* gnu/installer/utils.scm (open-syslog-port, syslog-port): New
procedures.
(syslog): New macro.
2020-02-22 00:45:42 +01:00
Ludovic Courtès 9529f7850e
installer: Take 'guix system init' exit code into account.
This allows the installer to distinguish success from failure, and also
ensures the shell that runs 'guix system init' exits upon completion.

* gnu/installer/utils.scm (run-shell-command)[pause]: New procedure.
Add "exec" before COMMAND in the script.  Guard 'invoke' call and handle
'invoke-error?'.  Add call to 'pause' on completion.
* gnu/installer/final.scm (install-system): Remove 'false-if-exception'.
2019-04-26 14:19:36 +02:00
Ludovic Courtès 7611074f67
installer: Run 'guix system init' with the right locale.
* gnu/installer/utils.scm (run-shell-command): Add #:locale and honor it.
* gnu/installer/newt/final.scm (run-install-shell): Add 'locale'
parameter; pass it to 'install-system'.
(run-final-page): Obtain locale from RESULT; pass it to 'run-install-shell'.
* gnu/installer/final.scm (install-system): Add 'locale' parameter; pass
it to 'run-shell-command'.
2019-04-23 00:34:47 +02:00
Mathieu Othacehe 3ad8f7757c
installer: Add new utils.
* gnu/installer/utils.scm (nearest-exact-integer): New exported procedure,
(read-percentage): ditto,
(run-shell-command): ditto.
2019-01-17 14:04:22 +01:00
Mathieu Othacehe d0f3a672dc
gnu: Add graphical installer support.
* configure.ac: Require that guile-newt is available.
* gnu/installer.scm: New file.
* gnu/installer/aux-files/logo.txt: New file.
* gnu/installer/build-installer.scm: New file.
* gnu/installer/connman.scm: New file.
* gnu/installer/keymap.scm: New file.
* gnu/installer/locale.scm: New file.
* gnu/installer/newt.scm: New file.
* gnu/installer/newt/ethernet.scm: New file.
* gnu/installer/newt/hostname.scm: New file.
* gnu/installer/newt/keymap.scm: New file.
* gnu/installer/newt/locale.scm: New file.
* gnu/installer/newt/menu.scm: New file.
* gnu/installer/newt/network.scm: New file.
* gnu/installer/newt/page.scm: New file.
* gnu/installer/newt/timezone.scm: New file.
* gnu/installer/newt/user.scm: New file.
* gnu/installer/newt/utils.scm: New file.
* gnu/installer/newt/welcome.scm: New file.
* gnu/installer/newt/wifi.scm: New file.
* gnu/installer/steps.scm: New file.
* gnu/installer/timezone.scm: New file.
* gnu/installer/utils.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add previous files.
* gnu/system.scm: Export %root-account.
* gnu/system/install.scm (%installation-services): Use kmscon instead of linux
VT for all tty.
(installation-os)[users]: Add the graphical installer as shell of the root
account.
[packages]: Add font related packages.
* po/guix/POTFILES.in: Add installer files.
2019-01-17 14:04:20 +01:00