base-files: upgrade: Fix export_partdevice() quoting

$BOOTDEV_MAJOR may be empty for many of the uevents parsed in this
function. This condition thus tends to fail benignly (we just skip to
the next device), but it can really clutter the stage2 sysupgrade
stderr, since it looks like the "=" operand doesn't have an appropriate
left-hand argument.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
This commit is contained in:
Brian Norris 2022-12-20 22:21:46 -08:00 committed by Hauke Mehrtens
parent d9a1eee764
commit 3cd882744d
1 changed files with 1 additions and 1 deletions

View File

@ -232,7 +232,7 @@ export_partdevice() {
while read line; do while read line; do
export -n "$line" export -n "$line"
done < "$uevent" done < "$uevent"
if [ $BOOTDEV_MAJOR = $MAJOR -a $(($BOOTDEV_MINOR + $offset)) = $MINOR -a -b "/dev/$DEVNAME" ]; then if [ "$BOOTDEV_MAJOR" = "$MAJOR" -a $(($BOOTDEV_MINOR + $offset)) = "$MINOR" -a -b "/dev/$DEVNAME" ]; then
export "$var=$DEVNAME" export "$var=$DEVNAME"
return 0 return 0
fi fi