[Bug 202058] bsdinstall - Disable dialog(3) for distfetch/checksum/distextract targets

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Nov 25 10:02:32 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202058

--- Comment #6 from Ganael LAPLANCHE <ganael.laplanche at corp.ovh.com> ---
Hi Devin,

Thank you very much for your answer.

There may be a misunderstanding (the title of my PR is propably inaccurate):
the goal of my patch is not to disable the need for dialog(3) at build time. My
initial -exact- need is to be able to run the tools over a SSH session without
a tty, but *without having to recompile the tools with a specific option*, so
we are mostly dealing with you suggestion 3 here. Making the tools build
WITHOUT_DIALOG is (in my opinion) a step further that can be achieved later.

Anyway, you're right, the 'nonInteractive' env variable is not appropriate
everywhere in my patches: sometimes it is used to prevent
dialog_msgbox(,,,,TRUE) from waiting for "OK" to be pressed after an error
message and sometimes it is also used to disable infoboxes or general dialog(3)
code. In the first case, I think it is OK, as pressing "OK" is an interactive
action. In the second case, we should probably introduce a way to disable
dialog(3) and use printf() instead.

So the patch should probably be re-written to split the modifications in two
kinds:

- the ones that really disable interactivity (dialog_msgbox(,,,,TRUE)) => can
be left as is IMHO
- the ones that really only deal with dialog(3) stuff => to be reworked. For
that purpose, we could introduce a new env variable ($noDialog ?) to keep the
global spirit of the tools.

Finaly, there is probably a relationship between the two variables :

/* ---- */

static uint8_t interactive = 1;
static uint8_t dialog = 1;

if (getenv("noDialog") != NULL) {
    interactive = 0;
    dialog = 0;
}

if (getenv("nonInteractive") != NULL) {
    interactive = 0;
}

/* ---- */

Does that seem reasonable to you ?

For the 'checksum' script, we could do the same kinds of modifications. E.g.,
for the second chunk :

+   if f_dialog; then
+       dialog --backtitle "FreeBSD Installer" --title "Checksum Verification"
\
+           --mixedgauge "Verifying checksums of selected distributions." \
+           0 0 $percentage $items
+   else
+       printf "Verifying checksum of %s\n" "$dist"
+   fi

 The third and last chunk should probably be rewritten that way :

+       if f_interactive; then
+           dialog --backtitle "FreeBSD Installer" --title "Error" \
+               --msgbox "The checksum for $dist does not match. It may have
become corrupted, and should be redownloaded." 0 0
+       else
+           if f_dialog; then
+               dialog --backtitle "FreeBSD Installer" --title "Error" \
+                   --infobox "The checksum for $dist does not match. It may
have become corrupted, and should be redownloaded." 0 0
+           else
+               f_err "The checksum for %s does not match. It may have become
corrupted, and should be redownloaded.\n" "$dist"
+           fi
+       fi

Not sure if f_dialog is well-chosen but you get the idea...

Regards,
Ganael.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-sysinstall mailing list