sysupgrade: umount temporary loop if check is successful (#756)

Co-authored-by: viktorxda <viktorxda@users.noreply.github.com>
pull/757/head
viktorxda 2023-04-30 16:13:59 +02:00 committed by GitHub
parent b645b5eb2a
commit 249df93180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -63,8 +63,9 @@ do_update_rootfs() {
local y=/tmp/rootfs
if mkdir -p "$y" && loop=$(losetup -f) && losetup "$loop" "$x" && mount "$loop" "$y"; then
check_soc "$(head -1 ${y}/etc/hostname | cut -d- -f2)"
compare_versions "$system_version" "$(get_system_version "$y")" && return 0
compare_versions "$system_version" "$(get_system_version "$y")" && exit_update=1
umount "$y" && rm -rf "$y" && losetup -d "$loop"
[ "$exit_update" ] && return 0
else
die "Unable to mount $y!"
fi