refs #311 #394 changes oglivecli to take isoname in download

pull/3/head
Luis Gerardo Romero Garcia 2024-05-27 12:15:20 +02:00
parent 9a7719b993
commit a13dabc93c
1 changed files with 13 additions and 4 deletions

View File

@ -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}')