From b0e76a9d537992cf2594f59c2c97f03c310fbac3 Mon Sep 17 00:00:00 2001 From: ser anat bat Date: Mon, 31 Oct 2022 22:32:38 +0700 Subject: [PATCH] Fix parted parsing for non-english locales --- live-usb-maker | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/live-usb-maker b/live-usb-maker index e309e0f..d816fe5 100755 --- a/live-usb-maker +++ b/live-usb-maker @@ -1567,7 +1567,7 @@ guess_partitioning() { esac # Get the type of partitioning - MSDOS_GPT=$(parted --script $drive unit MiB print | sed -n "s/^Partition Table: *//p") + MSDOS_GPT=$(LC_ALL=C parted --script $drive unit MiB print | sed -n "s/^Partition Table: *//p") msg $"Found %s partitioning" "$(pq $MSDOS_GPT)" encrypt && shout $"Assuming this is an encrypted live-usb" setup_devices $drive @@ -2033,7 +2033,7 @@ validate_fs_type() { #------------------------------------------------------------------------------ clear_partition() { local dev=$1 - local bytes=$(parted --script $dev unit B print 2>/dev/null | sed -rn "s/^Disk.*: ([0-9]+)B$/\1/ip") + local bytes=$(LC_ALL=C parted --script $dev unit B print 2>/dev/null | sed -rn "s/^Disk.*: ([0-9]+)B$/\1/ip") local block_size=512 local pt_size=$((17 * 1024)) local pt_cnt=$((pt_size / block_size)) @@ -2140,7 +2140,7 @@ _add_partition() { #------------------------------------------------------------------------------ get_total_size() { local dev=$1 - local bytes=$(parted --script $dev unit B print 2>/dev/null | sed -rn "s/^Disk.*: ([0-9]+)B$/\1/p") + local bytes=$(LC_ALL=C parted --script $dev unit B print 2>/dev/null | sed -rn "s/^Disk.*: ([0-9]+)B$/\1/p") [ -z "$bytes" ] && return echo $((bytes / 1024 / 1024)) }