Print directly used devices
This commit is contained in:
parent
627289d911
commit
6859a384f6
|
@ -281,6 +281,15 @@ disk_create_luks() {
|
|||
|| die "Could not open luks encrypted device '$device' ($id)"
|
||||
}
|
||||
|
||||
disk_create_dummy() {
|
||||
local new_id="${arguments[new_id]}"
|
||||
local device="${arguments[device]}"
|
||||
if [[ $disk_action_summarize_only == "true" ]]; then
|
||||
add_summary_entry __root__ "$new_id" "$device" "" ""
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
init_btrfs() {
|
||||
local device="$1"
|
||||
local desc="$2"
|
||||
|
@ -391,12 +400,13 @@ apply_disk_action() {
|
|||
unset known_arguments
|
||||
unset arguments; declare -A arguments; parse_arguments "$@"
|
||||
case "${arguments[action]}" in
|
||||
'create_gpt') disk_create_gpt ;;
|
||||
'create_partition') disk_create_partition ;;
|
||||
'create_raid') disk_create_raid ;;
|
||||
'create_luks') disk_create_luks ;;
|
||||
'format') disk_format ;;
|
||||
'format_btrfs') disk_format_btrfs ;;
|
||||
'create_gpt') disk_create_gpt ;;
|
||||
'create_partition') disk_create_partition ;;
|
||||
'create_raid') disk_create_raid ;;
|
||||
'create_luks') disk_create_luks ;;
|
||||
'create_dummy') disk_create_dummy ;;
|
||||
'format') disk_format ;;
|
||||
'format_btrfs') disk_format_btrfs ;;
|
||||
*) echo "Ignoring invalid action: ${arguments[action]}" ;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -48,15 +48,6 @@ only_one_of() {
|
|||
done
|
||||
}
|
||||
|
||||
create_new_id_directly() {
|
||||
local id="$1"
|
||||
[[ $id == *';'* ]] \
|
||||
&& die_trace 2 "Identifier contains invalid character ';'"
|
||||
[[ ! -v DISK_ID_TO_UUID[$id] ]] \
|
||||
|| die_trace 2 "Identifier '$id' already exists"
|
||||
DISK_ID_TO_UUID[$id]="$(load_or_generate_uuid "$(base64 -w 0 <<< "$id")")"
|
||||
}
|
||||
|
||||
create_new_id() {
|
||||
local id="${arguments[$1]}"
|
||||
[[ $id == *';'* ]] \
|
||||
|
@ -196,6 +187,23 @@ create_luks() {
|
|||
DISK_ACTIONS+=("action=create_luks" "$@" ";")
|
||||
}
|
||||
|
||||
# Named arguments:
|
||||
# new_id: Id for the new luks
|
||||
# device: The device
|
||||
create_dummy() {
|
||||
local known_arguments=('+new_id' '+device')
|
||||
local extra_arguments=()
|
||||
declare -A arguments; parse_arguments "$@"
|
||||
|
||||
create_new_id new_id
|
||||
|
||||
local new_id="${arguments[new_id]}"
|
||||
local device="${arguments[device]}"
|
||||
local uuid="${DISK_ID_TO_UUID[$new_id]}"
|
||||
create_resolve_entry_device "$new_id" "$device"
|
||||
DISK_ACTIONS+=("action=create_dummy" "$@" ";")
|
||||
}
|
||||
|
||||
# Named arguments:
|
||||
# id: Id of the device / partition created earlier
|
||||
# type: One of (bios, efi, swap, ext4, btrfs)
|
||||
|
@ -387,8 +395,7 @@ create_btrfs_raid_layout() {
|
|||
for i in "${!extra_arguments[@]}"; do
|
||||
[[ $i != 0 ]] || continue
|
||||
dev_id="root_dev$i"
|
||||
create_new_id_directly "$dev_id"
|
||||
create_resolve_entry_device "$dev_id" "${extra_arguments[$i]}"
|
||||
create_dummy new_id="$dev_id" device="${extra_arguments[$i]}"
|
||||
root_ids="${root_ids}$dev_id;"
|
||||
done
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue