diff --git a/bin/oglivecli b/bin/oglivecli index 7bd8246..6a33ea7 100755 --- a/bin/oglivecli +++ b/bin/oglivecli @@ -236,12 +236,21 @@ function download() { if [ -z "$1" ]; then downloadMenu else - local selected_id="$1" + local selected_name="$1" - # Obtener la opción correspondiente al ID seleccionado. + # Obtener la lista de archivos disponibles. OGLIVE=( $(curl -k --silent $DOWNLOADURL | grep "$DEFOGLIVE.*iso") ) - OGLIVEFILE=${OGLIVE[selected_id - 1]} - [ -n "$OGLIVEFILE" ] || raiseError download "ID $selected_id inválido." + + # Buscar el archivo seleccionado por nombre. + OGLIVEFILE="" + for iso in "${OGLIVE[@]}"; do + if [[ "$iso" == *"$selected_name"* ]]; then + OGLIVEFILE=$iso + break + fi + done + + [ -n "$OGLIVEFILE" ] || raiseError download "Nombre \"$selected_name\" inválido." # Obtener el tamaño de descarga. local SOURCELENGTH=$(curl -k --head --retry 5 --retry-delay 5 --max-time 30 "$DOWNLOADURL/$OGLIVEFILE" | awk -F: '/Content-Length:/ {print $2}')