[Merge] ~jefferyto/ubuntu/+source/initramfs-tools:ubuntu-core-dev-fix-resume-device-type-check into ~ubuntu-core-dev/ubuntu/+source/initramfs-tools:ubuntu/devel
Benjamin Drung
mp+468643 at code.launchpad.net
Thu Jul 4 11:28:45 UTC 2024
Commented below. I would be fine with all variants. Which one do you prefer?
Diff comments:
> diff --git a/hooks/resume b/hooks/resume
> index 8ff84dd..a13e5a2 100755
> --- a/hooks/resume
> +++ b/hooks/resume
> @@ -23,8 +23,9 @@ if [ -n "$RESUME" ] && [ "$RESUME" != auto ]; then
> if [ "$RESUME" = none ]; then
> exit 0
> fi
> - if resume_dev_node="$(resolve_device "$RESUME")" && \
> - blkid -p -n swap "$resume_dev_node" >/dev/null 2>&1; then
> + resume_dev_node=$(resolve_device "$RESUME")
> + resume_dev_type=$(blkid -p -s TYPE -o value "$resume_dev_node")
You are right. Calling `blkid -p -s TYPE -o value ""` will exit with code 2. What do you think about making this case more obvious? suggestion:
```
if resume_dev_node="$(resolve_device "$RESUME")"; then
resume_dev_type=$(blkid -p -s TYPE -o value "$resume_dev_node")
if [ "$resume_dev_type" = swap ]; then
exit 0
fi
fi
```
or
```
if resume_dev_node="$(resolve_device "$RESUME")" &&
[ "$(blkid -p -s TYPE -o value "$resume_dev_node")" = swap ]; then
exit 0
fi
fi
```
> + if [ "$resume_dev_type" = swap ]; then
> exit 0
> fi
>
--
https://code.launchpad.net/~jefferyto/ubuntu/+source/initramfs-tools/+git/initramfs-tools/+merge/468643
Your team Ubuntu Core Development Team is subscribed to branch ~ubuntu-core-dev/ubuntu/+source/initramfs-tools:ubuntu/devel.
More information about the Ubuntu-reviews
mailing list