Skip to content

Commit

Permalink
Update 300_format_usb_disk.sh
Browse files Browse the repository at this point in the history
In format/USB/default/300_format_usb_disk.sh when prompting user
for size of EFI system partition on USB disk if no valid value is specified
also use 400 MiB as default (same as the default value in default.conf)
cf. #1205 (comment) and
89e6a47
  • Loading branch information
jsmeix committed Jul 6, 2020
1 parent 805e346 commit 34e25eb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions usr/share/rear/format/USB/default/300_format_usb_disk.sh
Expand Up @@ -24,12 +24,12 @@ MiB_bytes=$(( 1024 * 1024 ))
if is_true "$EFI" ; then
LogPrint "The --efi toggle was used with format - making an EFI bootable device '$RAW_USB_DEVICE'"
# Prompt user for size of EFI system partition on USB disk if no valid value is specified:
while ! [[ "$USB_UEFI_PART_SIZE" =~ ^[0-9]+$ && $USB_UEFI_PART_SIZE > 0 ]] ; do
# When USB_UEFI_PART_SIZE is empty, do not falsely complain about "Invalid EFI partition size value":
test "$USB_UEFI_PART_SIZE" && LogPrintError "Invalid EFI system partition size value '$USB_UEFI_PART_SIZE' (must be unsigned integer larger than 0)"
USB_UEFI_PART_SIZE="$( UserInput -I USB_DEVICE_EFI_PARTITION_MIBS -p "Enter size for EFI system partition on '$RAW_USB_DEVICE' in MiB (plain 'Enter' defaults to 200 MiB)" )"
# Plain 'Enter' defaults to 200 MiB (same as the default value in default.conf):
test "$USB_UEFI_PART_SIZE" || USB_UEFI_PART_SIZE="200"
while ! is_positive_integer $USB_UEFI_PART_SIZE do

This comment has been minimized.

Copy link
@OliverO2

OliverO2 Jul 14, 2020

Contributor

@jsmeix
There's a semicolon missing ahead of do:

./usr/share/rear/format/USB/default/300_format_usb_disk.sh: line 33: syntax error near unexpected token `done'
./usr/share/rear/format/USB/default/300_format_usb_disk.sh: line 33: `    done'

This comment has been minimized.

Copy link
@jsmeix

jsmeix Jul 15, 2020

Author Member

@OliverO2
thank you so much!
Fortunately my bug here had happened after the ReaR 2.6 release.
I fixed it via
44f8553

This comment has been minimized.

Copy link
@OliverO2

OliverO2 Jul 15, 2020

Contributor

@jsmeix
Great, works now. BTW, the error came up when I tried to build a debian package (make deb) as part of the validation process. So it would have been almost impossible to miss during release preparations. Nonetheless, maybe it would be a good idea to run this on a regular basis via GitHub automation (e.g. on pull requests and nightly for direct commits). Using ReaR directly from master already works most of the time without issues, but there's always room to improve even more. 👍

This comment has been minimized.

Copy link
@jsmeix

jsmeix Jul 15, 2020

Author Member

As far as I know a bash -n test for all ReaR scripts happens
when a GitHub pull request is submitted.
I think @gdha may know more about such GitHub automated things.

But when I "just edit the master code directly" (via the GitHub web frontend)
then no automatism stops me from making mistakes.
Since I work in home office I use the GitHub web frontend frequently
because this way things are easier for me on my homeoffice laptop
in particular for small changes.

@gdha
is it possible to run a bash -n test for all ReaR scripts
automatically after each commit to the master branch?

# When USB_UEFI_PART_SIZE is empty, do not falsely complain about "Invalid EFI partition size":
test "$USB_UEFI_PART_SIZE" && LogPrintError "Invalid EFI system partition size USB_UEFI_PART_SIZE='$USB_UEFI_PART_SIZE' (must be positive integer)"
USB_UEFI_PART_SIZE="$( UserInput -I USB_DEVICE_EFI_PARTITION_MIBS -p "Enter size for EFI system partition on '$RAW_USB_DEVICE' in MiB (default 400 MiB)" )"
# Plain 'Enter' defaults to 400 MiB (same as the default value in default.conf):
test "$USB_UEFI_PART_SIZE" || USB_UEFI_PART_SIZE="400"
done
LogPrint "Creating GUID partition table (GPT) on '$RAW_USB_DEVICE'"
if ! parted -s $RAW_USB_DEVICE mklabel gpt >&2 ; then
Expand Down

0 comments on commit 34e25eb

Please sign in to comment.