feat: show added existing disks in action summary

This commit is contained in:
oddlama 2022-05-13 21:14:42 +02:00
parent 93f70f969c
commit 2003738dca
No known key found for this signature in database
GPG Key ID: 14EFE510775FE39A
2 changed files with 11 additions and 1 deletions

View File

@ -116,6 +116,7 @@ function register_existing() {
local new_id="${arguments[new_id]}"
local device="${arguments[device]}"
create_resolve_entry_device "$new_id" "$device"
DISK_ACTIONS+=("action=existing" "$@" ";")
}
# Named arguments:
@ -348,7 +349,7 @@ function create_single_disk_layout() {
die "'create_single_disk_layout' is deprecated, please use 'create_classic_single_disk_layout' instead. It is fully option-compatible to the old version."
}
# Skip partitioning, and use existing partitions.
# Skip partitioning, and use existing pre-formatted partitions. These must be trivially mountable.
# Parameters:
# swap=<device|false> Use the given device as swap, or no swap at all if set to false
# boot=<device> Use the given device as the bios/efi partition.

View File

@ -163,6 +163,14 @@ function summary_color_args() {
done
}
function disk_existing() {
local new_id="${arguments[new_id]}"
if [[ ${disk_action_summarize_only-false} == "true" ]]; then
add_summary_entry __root__ "$new_id" "${arguments[device]}" "(no-format, existing)" ""
fi
# no-op;
}
function disk_create_gpt() {
local new_id="${arguments[new_id]}"
if [[ ${disk_action_summarize_only-false} == "true" ]]; then
@ -563,6 +571,7 @@ function apply_disk_action() {
unset known_arguments
unset arguments; declare -A arguments; parse_arguments "$@"
case "${arguments[action]}" in
'existing') disk_existing ;;
'create_gpt') disk_create_gpt ;;
'create_partition') disk_create_partition ;;
'create_raid') disk_create_raid ;;