From 5985b56e46589cb23bbac4b9ab28169d46a816f4 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Fri, 14 Oct 2016 10:17:26 +0200 Subject: [PATCH] =?UTF-8?q?Correction=20de=20la=20m=C3=A9thode=20d'ajout?= =?UTF-8?q?=20de=20l'image=20iso.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On fait télécharger l'image iso directement par ONE. Pour l'instant pour garder l'esprit on attend la fin de l'initialisation pour rendre la main, mais on pourrais très bien laisser l'ajout se faire en tache de fond ref #17430 @1h (Contribution Cadoles) --- postservice/99-init-hapy-master | 34 +++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/postservice/99-init-hapy-master b/postservice/99-init-hapy-master index 92c346b..f1c161a 100755 --- a/postservice/99-init-hapy-master +++ b/postservice/99-init-hapy-master @@ -80,13 +80,7 @@ echo #***************************************************** if ! runOneCmd "oneimage" "show ${ISONAME}" &>/dev/null then - echo "***** Téléchargement de ${ISONAME} *****" - wget --output-document "/tmp/eole-${VERSIONISO}-alternate-amd64.iso" ${ISOURL} - echo "***** Création de ${ISONAME} *****" - if [ $? -ne 0 ]; then - echo "Erreur lors du téléchargement, Abandon" - exit 1 - fi + echo -ne "***** Création de l'image ${ISONAME} *****\n\n" FILE=$(mktemp) cat > ${FILE} </dev/null && break - runOneCmd "oneimage" "show ${ISONAME}" | grep STATE | grep lock &>/dev/null || break - echo -n "Attente : " - runOneCmd "oneimage" "show ${ISONAME}" | grep STATE - done + + spin='-\|/' + i=0 + while : + do + imgState=$(runOneCmd "oneimage" "show ${ISONAME}" | awk '{if ($1 == "STATE") {print $3}}') + if [[ ${imgState} == "lock" ]] + then + i=$(( (i+1) %4 )) + printf "\rInitialisation en cours, merci de patienter [${spin:$i:1}] " + sleep 2 + else + printf "\r Création terminée, l'image a le statut : ${imgState}\n" + break + fi + done rm -f "/tmp/eole-${VERSIONISO}-alternate-amd64.iso" else echo "***** ${ISONAME} existe déjà *****"