Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
310_include_uefi_tools.sh : fix the test for /boot/{efi|EFI} - see is…
- Loading branch information
6c477d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need for the complicated "| wc -l) -eq 0".
The root cause was missing quoting because
plain 'test -n' without argument results 'true':
Cf.
usr/share/rear/rescue/default/850_save_sysfs_uefi_vars.sh
6c477d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference: Also see
#1239
6c477d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand the logic:
According to
git log -p --follow usr/share/rear/prep/default/310_include_uefi_tools.sh
it was initially
which I understand:
"return when there is no /boot/efi directory".
This was changed by @ProBackup-nl to
which I do not understand because as far as I see this means:
"return if a /boot/[eE][fF][iI] directory can be found"
(find results a non-empty string which means it found something).
I think this is inverted logic compared to what it was before
or am I somehow blind and do not see how it actually works?
6c477d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did
#1246
a proposal how I think the test for
the /boot/efi directory might be simplified.
FYI:
Plain 'test' without anything results false:
in contrast to 'test -n' without argument for '-n':
at least on my SLES11 SP3 system.
6c477d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsmeis I think I did not change the logic (except for the quoting mistake).
original:
if [[ ! -d /boot/efi ]]; then
If no /boot/efi directory exists then... return
new:
if [[ -n "$(find /boot -maxdepth 1 -iname efi -type d)" ]]; then
If there is no /boot (case sensitive) /efi (case insensitive) directory then return.
The "directory not exists" logic
! -d
has been replaced by:find
result is empty:-n "$(find)"
.6c477d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But 'test -n' tests for non empty, i.e.
test -n "$( find ... )" is true when "$( find ... )" is not empty.