On 2023/04/01 16:33:39 +0300, Mikhail <mp39...@gmail.com> wrote:
> Currently default answer for the question is 'yes', which is not true
> for install case, but correct for upgrade one.
> 
> Changing default answer depending on the mode of the installer looks
> like a good approach. Idea by Christian (naddy@), implementation and
> testing are mine.

fwiw I like the idea too!  Doing the first install it's easy to assume
that the usb stick one is booting from is mounted and so mistakenly
reply "yes".  No big deal, but it saves a few back and forths in the
installer (and few mails to misc@ ;-)

I remember being surprised when the default for this was changed from
"no" to "yes".

> diff /usr/src
> commit - c5d97e146b0b84b5aaf0732c7ffb8b845cadd04d
> path + /usr/src
> blob - c5d0d7f129960a410a8c89af1d480135f6a18d09
> file + distrib/miniroot/install.sub
> --- distrib/miniroot/install.sub
> +++ distrib/miniroot/install.sub
> @@ -2042,7 +2042,12 @@ install_disk() {
>  # Install sets from disk.
>  # Ask for the disk device containing the set files.
>  install_disk() {
> -     if ! ask_yn "Is the disk partition already mounted?" yes; then
> +     local _answer

not very familiar with install.sub, but I'd change _answer to default to yes

> +     # In installation mode installer doesn't automount partitions
> +     [[ $MODE == install ]] || _answer=yes

and toggle it here to no (or flip the logic); would be clearer IMHO
and would resemble more questions().

This is also the first instance as far as I can see where $MODE would
change the default reply for a question.  No idea if this is
important.  Also, untested, but it reads fine :)

> +     if ! ask_yn "Is the disk partition already mounted?" $_answer; then
>               ask_which "disk" "contains the $MODE media" \
>                       '$(bsort $(get_dkdevs))' \
>                       '$(get_dkdevs_uninitialized)'


Thanks!

Reply via email to