Fix error when cleanup is called before nbd_dev is set

This commit is contained in:
Jakub Jirutka 2017-10-11 20:23:29 +02:00
parent 5059118e8c
commit fb0ad9b107

View file

@ -117,9 +117,10 @@ cleanup() {
|| die "Failed to unmount $mount_dir; unmount it and disconnect $nbd_dev manually" || die "Failed to unmount $mount_dir; unmount it and disconnect $nbd_dev manually"
rm -Rf "$mount_dir" || : rm -Rf "$mount_dir" || :
fi fi
if [ -n "$nbd_dev" ]; then
qemu-nbd --disconnect "$nbd_dev" \ qemu-nbd --disconnect "$nbd_dev" \
|| die "Failed to disconnect $nbd_dev; disconnect it manually" || die "Failed to disconnect $nbd_dev; disconnect it manually"
fi
if [ "$INSTALL_HOST_PKGS" = yes ]; then if [ "$INSTALL_HOST_PKGS" = yes ]; then
_apk del $VIRTUAL_PKG _apk del $VIRTUAL_PKG
fi fi