From d8f9ff5523073d11173ac2bc05f93606ec8401c7 Mon Sep 17 00:00:00 2001 From: lgromero Date: Mon, 13 Jan 2025 10:31:27 +0100 Subject: [PATCH] refs #1271 modifies install that dont allow download iso when oglive is already installed --- bin/oglivecli | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bin/oglivecli b/bin/oglivecli index 35ccc8c..7dd741c 100755 --- a/bin/oglivecli +++ b/bin/oglivecli @@ -139,6 +139,8 @@ function download() { else local download_url="$1" OGLIVEFILE=$(basename "$download_url") + local oglive_name="${OGLIVEFILE%.iso}" # Nombre del ogLive sin la extensión .iso + INSTALLED_PATH="$TFTPDIR/$oglive_name" # Ruta de instalación donde se verifica # Validar que la URL apunte a un archivo ISO. if [[ ! "$OGLIVEFILE" =~ \.iso$ ]]; then @@ -148,6 +150,18 @@ function download() { # Obtener el tamaño de descarga. SOURCELENGTH=$(curl -k --head --retry 5 --retry-delay 5 --max-time 30 "$download_url" | awk -F: '/Content-Length:/ {print $2}') [ -n "$SOURCELENGTH" ] || raiseError download "No se pudo obtener el tamaño del archivo desde \"$download_url\"." + + # Verificar si el ogLive ya está instalado + if [ -d "$INSTALLED_PATH" ]; then + echo "El ogLive \"$oglive_name\" ya está instalado en \"$INSTALLED_PATH\"." + return 0 + fi + # Verificar si el ogLive ya está instalado + echo $INSTALLED_PATH + if [ -d "$INSTALLED_PATH" ]; then + echo "El ogLive \"$oglive_name\" ya está instalado en \"$INSTALLED_PATH\"." + return 0 + fi # Descargar ogLive. TARGETFILE="$DOWNLOADDIR/$OGLIVEFILE"