refs #2788 adds retries and dont stop de debian installation if oglive failed

oglive-downloaded-debian
Luis Gerardo Romero Garcia 2025-09-16 07:37:16 +02:00
parent f3495af658
commit b24c2e5db9
2 changed files with 12 additions and 36 deletions

View File

@ -233,41 +233,6 @@ function downloadMenu() {
'{downloads: $downloads}'
}
# Show a menu to select and download an ogLive ISO image from the OpenGnsys website.
function download_old() {
local OGLIVE NISOS i HTTPCODE TARGETFILE
local ISOREL
[ $# -gt 1 ] && raiseError usage
[ ! -d $DOWNLOADDIR ] && raiseError notfound "Download directory."
[ ! -w $DOWNLOADDIR ] && raiseError access "Download directory."
# Check parameter.
if [ -n "$1" ]; then
# ogLive to download.
OGLIVEFILE="$1"
else
# Show download menu.
OGLIVE=( $(curl -k --silent $DOWNLOADURL | grep "$DEFOGLIVE.*iso") )
NISOS=${#OGLIVE[@]}
echo "Available downloads (+ = installed, * = full compatibility):"
for i in $(seq 1 $NISOS); do
[ -e $DOWNLOADDIR/${OGLIVE[i-1]} ] && OGLIVE[i-1]="(+) ${OGLIVE[i-1]}"
ISOREL=${OGLIVE[i-1]##*-r}; ISOREL=${ISOREL%%.*}
[ $ISOREL -ge $MINREL ] && OGLIVE[i-1]="(*) ${OGLIVE[i-1]}"
done
select opt in "${OGLIVE[@]}"; do
[ -n "$opt" ] && OGLIVEFILE=${opt##* } && break
done
fi
# Get download size.
SOURCELENGTH=$(curl -k --head --retry 5 --retry-delay 5 --max-time 30 $DOWNLOADURL/$OGLIVEFILE | awk -F: '/Content-Length:/ {print $2}')
[ -n "$SOURCELENGTH" ] || raiseError download "$OGLIVEFILE"
# Download ogLive.
TARGETFILE=$DOWNLOADDIR/$OGLIVEFILE
trap "rm -f $TARGETFILE" 1 2 3 6 9 15
curl -k --retry 5 --retry-delay 5 --max-time 30 $DOWNLOADURL/$OGLIVEFILE -o $TARGETFILE || raiseError download "\"$OGLIVEFILE\"."
}
update_json() {
local key=$1
local value=$2

View File

@ -95,7 +95,18 @@ echo "Modificando el archivo tftpboot"
install_oglive(){
echo "Download ogLive"
/opt/opengnsys/ogboot/bin/oglivecli download "$DEFAULT_OGLIVE"
MAX_ATTEMPTS=3
ATTEMPT=1
SUCCESS=0
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
/opt/opengnsys/ogboot/bin/oglivecli download "$DEFAULT_OGLIVE" && SUCCESS=1 && break
echo "Intento $ATTEMPT de descarga de ogLive fallido."
ATTEMPT=$((ATTEMPT+1))
sleep 2
done
if [ $SUCCESS -eq 0 ]; then
echo "Error: No se pudo descargar ogLive después de $MAX_ATTEMPTS intentos. Continuando..."
fi
}
configure_ipxe(){