Wait 3 seconds inside format_drive function, not in the caller

This commit is contained in:
ValdikSS 2022-01-07 04:14:57 +03:00
parent 00d4a7ea5a
commit fd26a51536

View File

@ -52,6 +52,7 @@ function format_drive() {
if [[ "$1" == "dos" ]] || [[ "$1" == "gpt" ]]; if [[ "$1" == "dos" ]] || [[ "$1" == "gpt" ]];
then then
echo "label: $1" | sfdisk "$2" echo "label: $1" | sfdisk "$2"
sleep 3
else else
echo "${bold} == format_drive: INTERNAL ERROR ==${normal}" echo "${bold} == format_drive: INTERNAL ERROR ==${normal}"
exit 101 exit 101
@ -240,9 +241,6 @@ then
echo "${bold} == Creating new MBR-formatted partition table ==${normal}" echo "${bold} == Creating new MBR-formatted partition table ==${normal}"
format_drive "dos" "$dev" format_drive "dos" "$dev"
echo "${bold} == Waiting 3 seconds to settle new partition layout ==${normal}"
sleep 3
echo "${bold} == Creating FAT partition ==${normal}" echo "${bold} == Creating FAT partition ==${normal}"
create_partitions "dos" "$dev" create_partitions "dos" "$dev"
mkfs.vfat -n "${isolabel:0:11}" "$(get_dev_partition_num "${dev}" "1")" mkfs.vfat -n "${isolabel:0:11}" "$(get_dev_partition_num "${dev}" "1")"
@ -260,9 +258,6 @@ then
echo "${bold} == Creating new GPT-formatted partition table ==${normal}" echo "${bold} == Creating new GPT-formatted partition table ==${normal}"
format_drive "gpt" "$dev" format_drive "gpt" "$dev"
echo "${bold} == Waiting 3 seconds to settle new partition layout ==${normal}"
sleep 3
echo "${bold} == Creating FAT partition ==${normal}" echo "${bold} == Creating FAT partition ==${normal}"
create_partitions "gpt" "$dev" create_partitions "gpt" "$dev"
mkfs.vfat -n "${isolabel:0:11}" "$(get_dev_partition_num "${dev}" "1")" mkfs.vfat -n "${isolabel:0:11}" "$(get_dev_partition_num "${dev}" "1")"
@ -278,9 +273,6 @@ then
echo "${bold} == Creating new GPT-formatted partition table ==${normal}" echo "${bold} == Creating new GPT-formatted partition table ==${normal}"
format_drive "gpt" "$dev" format_drive "gpt" "$dev"
echo "${bold} == Waiting 3 seconds to settle new partition layout ==${normal}"
sleep 3
echo "${bold} == Creating Microsoft NTFS partition ==${normal}" echo "${bold} == Creating Microsoft NTFS partition ==${normal}"
create_partitions "gptntfs" "$dev" create_partitions "gptntfs" "$dev"
mkfs.ntfs -L "$isolabel" -f "$(get_dev_partition_num "${dev}" "1")" mkfs.ntfs -L "$isolabel" -f "$(get_dev_partition_num "${dev}" "1")"
@ -296,9 +288,6 @@ then
echo "${bold} == Creating new GPT-formatted partition table ==${normal}" echo "${bold} == Creating new GPT-formatted partition table ==${normal}"
format_drive "gpt" "$dev" format_drive "gpt" "$dev"
echo "${bold} == Waiting 3 seconds to settle new partition layout ==${normal}"
sleep 3
echo "${bold} == Creating UEFI FAT and Microsoft NTFS partitions ==${normal}" echo "${bold} == Creating UEFI FAT and Microsoft NTFS partitions ==${normal}"
create_partitions "gpt+uefintfs" "$dev" create_partitions "gpt+uefintfs" "$dev"
write_uefintfs "$(get_dev_partition_num "${dev}" "1")" write_uefintfs "$(get_dev_partition_num "${dev}" "1")"