#1486 PR merged: In 300_map_disks.sh use runtime generated UserInput-IDs

Labels: enhancement, bug, cleanup, fixed / solved / done

jsmeix opened issue at 2017-09-12 14:29:

In 300_map_disks.sh use runtime generated UserInput-IDs
to support multiple same UserInput calls for different devices
that need to be mapped.

This one implements the missing part in
https://github.com/rear/rear/pull/1473#issuecomment-328832250

How it looks now compared to
https://github.com/rear/rear/pull/1473#issuecomment-328811035

RESCUE e205:~ # export USER_INPUT_LAYOUT_MIGRATION_REPLACEMENT_SDA="1"

RESCUE e205:~ # export USER_INPUT_LAYOUT_MIGRATION_CONFIRM_MAPPINGS="yEs"

RESCUE e205:~ # rear recover
...
Comparing disks.
Device sda has size 22548578304, 21474836480 expected
Switching to manual disk layout configuration.
Original disk /dev/sda does not exist (with same size) in the target system
Choose an appropriate replacement for /dev/sda
1) /dev/sda
2) /dev/sdb
3) Do not map /dev/sda
4) Use Relax-and-Recover shell and return back to here
(default 1 timeout 300 seconds)
UserInput: Will use predefined input in 'USER_INPUT_LAYOUT_MIGRATION_REPLACEMENT_SDA'='1'
Hit any key to interrupt the automated input (timeout 5 seconds)
Using /dev/sda (chosen by user) for recreating /dev/sda
Current disk mapping table (source -> target):
    /dev/sda /dev/sda
Confirm or edit the disk mapping
1) Confirm disk mapping and continue 'rear recover'
2) Edit disk mapping (/var/lib/rear/layout/disk_mappings)
3) Use Relax-and-Recover shell and return back to here
4) Abort 'rear recover'
(default 1 timeout 300 seconds)
UserInput: Will use predefined input in 'USER_INPUT_LAYOUT_MIGRATION_CONFIRM_MAPPINGS'='1'
Hit any key to interrupt the automated input (timeout 5 seconds)
User confirmed disk mapping
...

jsmeix commented at 2017-09-13 13:06:

@schabrolles
run ReaR with the '-d' option so that
the UserInput function will show you its ID.

In your output there is

14Using /dev/mapper/mpatha (default choice)

which indicates you had typed only '14' but did not [Enter]
so that after the timeout the default was used.

jsmeix commented at 2017-09-13 13:08:

Hide some (uselesss?) of the devices presented
shoud be done via a well separated pull request.

jsmeix commented at 2017-09-14 10:38:

Now things seem to work as intended (at least for me):

# export USER_INPUT_LAYOUT_MIGRATION_REPLACEMENT_SDA="/dev/sda"

# export USER_INPUT_LAYOUT_MIGRATION_CONFIRM_MAPPINGS="yEs"

# rear recover
...
Comparing disks.
Device sda has size 22548578304, 21474836480 expected
Switching to manual disk layout configuration.
Original disk /dev/sda does not exist (with same size) in the target system
Choose an appropriate replacement for /dev/sda
1) /dev/sda
2) /dev/sdb
3) Do not map /dev/sda
4) Use Relax-and-Recover shell and return back to here
(default 1 timeout 300 seconds)
UserInput: Will use predefined input in 'USER_INPUT_LAYOUT_MIGRATION_REPLACEMENT_SDA'='/dev/sda'
Hit any key to interrupt the automated input (timeout 5 seconds)
Using /dev/sda (chosen by user) for recreating /dev/sda
Current disk mapping table (source -> target):
    /dev/sda /dev/sda
Confirm or edit the disk mapping
1) Confirm disk mapping and continue 'rear recover'
2) Edit disk mapping (/var/lib/rear/layout/disk_mappings)
3) Use Relax-and-Recover shell and return back to here
4) Abort 'rear recover'
(default 1 timeout 300 seconds)
UserInput: Will use predefined input in 'USER_INPUT_LAYOUT_MIGRATION_CONFIRM_MAPPINGS'='Confirm disk mapping and continue 'rear recover''
Hit any key to interrupt the automated input (timeout 5 seconds)
User confirmed disk mapping

[Export of Github issue for rear/rear.]