From 91fd39a9a572f94127fc9aef1bbedfb66c8ad0b9 Mon Sep 17 00:00:00 2001 From: lgromero Date: Fri, 20 Jun 2025 14:33:23 +0200 Subject: [PATCH] Fixes oglivecli to unmount mount points in case of any failure during the oglive installation script --- CHANGELOG.md | 4 ++++ bin/oglivecli | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f6743b..de8dc62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.8.4] - 2024-06-20 +### Changed +- Corrige oglivecli para que desmonte los puntos de montaje ante cualquier fallo en el script de instalación de oglive + ## [0.8.3] - 2024-06-20 ### Changed - Añade el cambio de la 0.8.2 diff --git a/bin/oglivecli b/bin/oglivecli index df17ab3..23d7b56 100755 --- a/bin/oglivecli +++ b/bin/oglivecli @@ -334,6 +334,20 @@ function install() { [ ! -d "$TMPDIR_SQUASHFS" ] && { echo "{\"error\": \"DIR_CREATION_FAILED\", \"message\": \"Failed to create/access directory $TMPDIR_SQUASHFS.\"}"; exit 500; } trap "umount $TMPDIR" 1 2 3 6 9 15 + + cleanup() { + code=$? + umount "$OGLIVEFILE" >/dev/null 2>&1 + umount "$TMPDIR" >/dev/null 2>&1 + umount "$TMPDIR_SQUASHFS" >/dev/null 2>&1 + if [ $code -ne 0 ]; then + echo "Something went wrong (exit code $code), cleaning up..." + rm -r "$OGLIVEDIR" >/dev/null 2>&1 + fi + } + + trap cleanup EXIT + mount "$OGLIVEFILE" >/dev/null 2>&1 || { echo "{\"error\": \"MOUNT_FAILED\", \"message\": \"Failed to mount ISO file.\"}"; exit 500; } cp -va "$TMPDIR/ogclient/"* "$OGLIVEDIR" >/dev/null 2>&1 || { echo "{\"error\": \"COPY_FAILED\", \"message\": \"Cannot copy files to $OGLIVEDIR.\"}"; exit 500; }