On Sat, Apr 01, 2023 at 04:31:59PM +0000, Klemens Nanni wrote:
> 01.04.2023 13:33, Mikhail пишет:
> $_answer may be unset, but you still pass it and thus rely on ask_yn()'s
> default 'no' answer.
> 
> I'd just default-initialise up front and flip if conditions are met.
> This should read and reflect your intentions more clearly:
> 
>       local _answer=no
> 
>       [[ $MODE == upgrade ]] && _answer=yes

I agree with your and Omar's comments regarding the logic, here is
revised patch:

diff /usr/src
commit - 05633f8622c7ca2ec993bbb49b8324988d6be874
path + /usr/src
blob - 537a9ae361201fb685525ac31c6ab7cf374799a4
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=no
+
+       # In upgrade mode root disk's /etc/fstab are automounted
+       [[ $MODE == upgrade ]] && _answer=yes
+
+       if ! ask_yn "Is the disk partition already mounted?" $_answer; then
                ask_which "disk" "contains the $MODE media" \
                        '$(bsort $(get_dkdevs))' \
                        '$(get_dkdevs_uninitialized)'

Reply via email to