From 6f25eae01598c9f66d7c6f85ce9a819ddedc8236 Mon Sep 17 00:00:00 2001 From: oddlama Date: Tue, 1 Jun 2021 02:50:08 +0200 Subject: [PATCH] Use wipefs before creating partitions or formatting --- configure | 4 ++-- scripts/functions.sh | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 2d7ecf9..72a6827 100755 --- a/configure +++ b/configure @@ -328,7 +328,7 @@ function load_default_config() { function disk_configuration() { #create_zfs_centric_layout swap=8GiB type=efi encrypt=true pool_type=standard /dev/sdX - create_single_disk_layout swap=8GiB type=efi luks=true root_fs=ext4 /dev/sdX + create_classic_single_disk_layout swap=8GiB type=efi luks=true root_fs=ext4 /dev/sdX } SYSTEMD=true @@ -830,7 +830,7 @@ function PARTITIONING_ROOT_FS_menu() { fi } -function PARTITIONING_USE_LUKS_tag() { echo " ├ Use LUKS"; } +function PARTITIONING_USE_LUKS_tag() { echo " ├ LUKS Encryption"; } function PARTITIONING_USE_LUKS_label() { on_off_label "$PARTITIONING_USE_LUKS" " ├ "; } function PARTITIONING_USE_LUKS_show() { [[ $PARTITIONING_SCHEME != "custom" ]] && one_of "$PARTITIONING_SCHEME" "classic_single_disk" "btrfs_centric"; } function PARTITIONING_USE_LUKS_help() { echo "Determines if LUKS will be used to encrypt your root partition. You can export the desired encryption key via export GENTOO_INSTALL_ENCRYPTION_KEY='...' before installing if you don't want to be asked."; } diff --git a/scripts/functions.sh b/scripts/functions.sh index e80b2fb..cbd417a 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -180,6 +180,8 @@ function disk_create_gpt() { local ptuuid="${DISK_ID_TO_UUID[$new_id]}" einfo "Creating new gpt partition table ($new_id) on $device_desc" + wipefs --quiet --all --force "$device" \ + || die "Could not erase previous file system signatures from '$device'" sgdisk -Z -U "$ptuuid" "$device" >/dev/null \ || die "Could not create new gpt partition table ($new_id) on '$device'" partprobe "$device" @@ -358,7 +360,11 @@ function disk_format() { local device device="$(resolve_device_by_id "$id")" \ || die "Could not resolve device with id=$id" + einfo "Formatting $device ($id) with $type" + wipefs --quiet --all --force "$device" \ + || die "Could not erase previous file system signatures from '$device' ($id)" + case "$type" in 'bios'|'efi') if [[ -v "arguments[label]" ]]; then @@ -413,6 +419,7 @@ function format_zfs_standard() { local devices=("$@") einfo "Creating zfs pool on $devices_desc" + local extra_args=() if [[ "$encrypt" == true ]]; then extra_args+=( @@ -476,6 +483,9 @@ function disk_format_zfs() { done devices_desc="${devices_desc:0:-2}" + wipefs --quiet --all --force "${devices[@]}" \ + || die "Could not erase previous file system signatures from $devices_desc" + if [[ "$pool_type" == "custom" ]]; then format_zfs_custom "$encrypt" "$devices_desc" "${devices[@]}" else @@ -511,6 +521,9 @@ function disk_format_btrfs() { done devices_desc="${devices_desc:0:-2}" + wipefs --quiet --all --force "${devices[@]}" \ + || die "Could not erase previous file system signatures from $devices_desc" + # Collect extra arguments extra_args=() if [[ "${#devices}" -gt 1 ]] && [[ -v "arguments[raid_type]" ]]; then