Bonjour,
Je vous propose un petit script nommé "nas4free-download-v0.1.sh" que j'ai écris en shell et zénity pour poste client Linux (pour l'instant) équipé du package "zenity".
Ce script permet de télécharger, en les choisissant, les fichiers d'installation/mise à jour, checksum et readme.txt d'une version de Nas4Free,
et de vérifier l'intégrité des fichiers téléchargés.
Ce script n'a rien d'ambitieux et est encore très perfectible.
C'est la version 0.1.
Vous le trouverez à l'adresse suivante : nas4free-download-v0.1.sh
Cordialement.
This is the old XigmaNAS forum in read only mode,
it will taken offline by the end of march 2021!
I like to aks Users and Admins to rewrite/take over important post from here into the new fresh main forum!
Its not possible for us to export from here and import it to the main forum!
it will taken offline by the end of march 2021!
I like to aks Users and Admins to rewrite/take over important post from here into the new fresh main forum!
Its not possible for us to export from here and import it to the main forum!
Script de téléchargement et de checksum Nas4Free
Moderators: velivole18, ernie, mtiburs
- velivole18
- Forum Moderator

- Posts: 647
- Joined: 14 Jul 2012 20:23
- Location: France
- Status: Offline
Script de téléchargement et de checksum Nas4Free
11.2.0.4 - Omnius (revision 6026) x64-embedded
111909 RSDT1411 AMD Athlon(tm) 64 Processor 4000+ 4096MiB RAM - HDD 2 x 6 To in ZFS mirroring + 2 x (2 x 4To in ZFS mirroring) - SSD 32Go - UPS EATON Ellipse MAX 1100.
111909 RSDT1411 AMD Athlon(tm) 64 Processor 4000+ 4096MiB RAM - HDD 2 x 6 To in ZFS mirroring + 2 x (2 x 4To in ZFS mirroring) - SSD 32Go - UPS EATON Ellipse MAX 1100.
- velivole18
- Forum Moderator

- Posts: 647
- Joined: 14 Jul 2012 20:23
- Location: France
- Status: Offline
Re: Script de téléchargement et de checksum Nas4Free
Bonjour,
Voici la version 0.3 de mon petit script nommé "nas4free-download-v0.3.sh" que j'ai écris en shell et zenity pour poste client Linux (pour l'instant) équipé du package "zenity".
Ce script permet de télécharger, en les choisissant, les fichiers d'installation/mise à jour, checksum et readme.txt d'une version de Nas4Free,
et de vérifier l'intégrité des fichiers téléchargés.
Ce script n'a rien d'ambitieux et est encore très perfectible.
Pourquoi la version 0.3 ? Parce qu'en version 11 de FreeBSD il n'y a plus en téléchargement les distributions 32 bits de Nas4Free et parce que le nom du fichier readme a changé.
Cordialement.
Voici la version 0.3 de mon petit script nommé "nas4free-download-v0.3.sh" que j'ai écris en shell et zenity pour poste client Linux (pour l'instant) équipé du package "zenity".
Ce script permet de télécharger, en les choisissant, les fichiers d'installation/mise à jour, checksum et readme.txt d'une version de Nas4Free,
et de vérifier l'intégrité des fichiers téléchargés.
Ce script n'a rien d'ambitieux et est encore très perfectible.
Pourquoi la version 0.3 ? Parce qu'en version 11 de FreeBSD il n'y a plus en téléchargement les distributions 32 bits de Nas4Free et parce que le nom du fichier readme a changé.
Code: Select all
#! /bin/sh
#====================================================================================
# nas4free-download.sh pour Linux
#-----------------------------------
#
# - version 0.2 du 25/10/2015 :
# Ajout de la possibilité de télécharger les distributions Beta et ARM de Nas4Free
#
# - version 0.3 du 26/11/2016 :
# Ajout de la possibilité de téécharger Nas4Free en version 11 (modif nom fichier readme et disparition des versions 32 bits)
#
#====================================================================================
#set -x
#exec 2>/dev/null
#====================================================================================
# Précautions
#====================================================================================
precautions()
{
zenity --info \
--title="Informations :" \
--no-wrap \
--text="Faire une sauvegarde de la configuration de votre\nserveur actuel et lire le fichier readme.txt de la distribution avant\nd'installer une nouvelle version !"
}
#====================================================================================
# Aide
#====================================================================================
aide()
{
#-------------------------------------------
# affichage de l'aide sur ce shell
#-------------------------------------------
echo "<B><U>
Définition des options du menu d'accueil de nas4free-download.sh (version 0.1 du 25/08/2013) :</U></B><BR><BR>
<B><U>quitter</U></B> : quitte ce programme<BR><BR>
<B><U>aide</U></B> : affiche cette aide<BR><BR>
<B><U>télécharger</U></B> : télécharge une ou plusieurs distributions d'une version donnée<BR>
sont demandés :<BR>
- la version des distributions désirées (par exemple : 9.1.0.1.847)<BR>
- un répertoire de téléchargement<BR>
- les fichiers à télécharger correspondant à la version saisie<BR>
un répertoire nommé avec le numéro de version est créé dans le répertoire de téléchargement<BR>
puis le téléchargement s'effectue séquentiellement dans le répertoire créé sous le répertoire de téléchargement<BR>
un fichier log est créé dans le répertoire de la version téléchargée pour chaque fichier Nas4Free téléchargé<BR><BR>
<B><U>intégrité</U></B> : teste l'intégrité d'une ou plusieurs distributions<BR>
la présence du bon fichier *.checksum correspondant à la version et à l'architecture est obligatoire dans le répertoire testé<BR>
une liste de tous les fichiers présents dans le répertoire testé est affichée en premier lieu<BR>
ensuite les tests d'intégrité ont lieu et le résultat de ces tests est ensuite affiché<BR>
pour un fichier testé, une ligne de résultat commancant par OK indique que l'intégrité est correcte<BR>
pour un fichier testé, une ligne de résultat commancant par !!! KO indique que l'intégrité n'est pas correcte<BR><BR>
<B><U>à propos</U></B> : affiche l'à propos de zenity<BR><BR>
Pour contacter l'auteur \"velivole18\" ou faire des remarques sur ce script, rendez-vous sur le forum français de Nas4Free à l'adresse suivante :<BR>
http://forums.nas4free.org/viewforum.php?f=35" > ${TMP}/aide.html
zenity --text-info \
--width=1000 \
--height=500 \
--html \
--filename=${TMP}/aide.html
}
#====================================================================================
# Télécharger
#====================================================================================
telecharger()
{
SITE="http://freefr.dl.sourceforge.net/project/nas4free"
# SITE="netcologne.dl.sourceforge.net"
liste_types_processeurs="FALSE ARM Processeurs_de_la_famille_ARM FALSE Intel_Amd Processeur_de_la_famille_Intel_ou_Amd"
PROCESSEUR=`zenity --width=500 \
--height=250 \
--list \
--title="Choix de la famille de processeurs" \
--radiolist \
--text="Sélectionnez l'option :" \
--column="Choix" \
--column="Options" \
--column="Informations" \
$liste_types_processeurs`
if (test ${#PROCESSEUR} -eq 0)
then return
fi
liste_maturites="FALSE ALPHA version_ALPHA_de_la_distribution FALSE BETA version_BETA_de_la_distribution FALSE NORMALE version_NORMALE_de_la_distribution"
MATURITE=`zenity --width=500 \
--height=250 \
--list \
--title="Choix de la maturité de la distribution" \
--radiolist \
--text="Sélectionnez l'option :" \
--column="Choix" \
--column="Options" \
--column="Informations" \
$liste_maturites`
if (test ${#MATURITE} -eq 0)
then return
fi
VERSION=`zenity --entry --text="version de la distribution (par ex. 9.1.0.1.847) :" --entry-text=$VERSION`
VERSION_FREEBSD=`echo $VERSION | cut -d"." -f"-2"`
VERSION_MAJEURE=`echo $VERSION | cut -d"." -f"-4"`
VERSION_MINEURE=`echo $VERSION | cut -d"." -f"5-"`
if (test ${#VERSION} -eq 0)
then return
fi
if ([ $PROCESSEUR = ARM ])
then liste_fichiers="FALSE NAS4Free-rpi2-embedded-${VERSION}.img.xz rpi2-embedded \
FALSE NAS4Free-rpi2-SD-${VERSION}.img rpi2-SD \
FALSE NAS4Free-rpi2-${VERSION}.checksum rpi2 \
FALSE NAS4Free-rpi-embedded-${VERSION}.img.xz rpi-embedded \
FALSE NAS4Free-rpi-SD-${VERSION}.img rpi-SD \
FALSE NAS4Free-oc1-embedded-${VERSION}.img.xz oc1-embedded \
FALSE NAS4Free-rpi-${VERSION}.checksum rpi \
FALSE NAS4Free-oc1-SD-${VERSION}.img oc1-SD \
FALSE NAS4Free-oc1-${VERSION}.checksum oc1_Checksum"
fi
if [ $PROCESSEUR = Intel_Amd -a "$VERSION_FREEBSD" -le 10 ]
then liste_fichiers="FALSE NAS4Free-x86-embedded-${VERSION}.img.xz x86_Embedded \
FALSE NAS4Free-x86-LiveUSB-${VERSION}.img.gz x86_LiveUSB \
FALSE NAS4Free-x86-LiveCD-${VERSION}.iso x86_LiveCD \
FALSE NAS4Free-x86-${VERSION}.checksum x86_Checksum \
FALSE NAS4Free-x64-embedded-${VERSION}.img.xz x64_Embedded\
FALSE NAS4Free-x64-LiveUSB-${VERSION}.img.gz x64_LiveUSB \
FALSE NAS4Free-x64-LiveCD-${VERSION}.iso x64_LiveCD \
FALSE NAS4Free-x64-${VERSION}.checksum x64_Checksum \
FALSE readme.txt Readme"
fi
if [ $PROCESSEUR = Intel_Amd -a "$VERSION_FREEBSD" -gt 10 ]
then liste_fichiers="FALSE NAS4Free-x64-embedded-${VERSION}.img.xz x64_Embedded\
FALSE NAS4Free-x64-LiveUSB-${VERSION}.img.gz x64_LiveUSB \
FALSE NAS4Free-x64-LiveCD-${VERSION}.iso x64_LiveCD \
FALSE NAS4Free-x64-${VERSION}.checksum x64_Checksum \
FALSE readme_${VERSION_FREEBSD}.txt Readme"
fi
FICHIERS=`zenity --width=500 --height=400 --list --multiple --title="liste des fichiers de distributions à télécharger" --checklist --separator=" " --text="Sélectionnez les fichiers :" --column="Choix" --column="Fichiers" --column="Informations" $liste_fichiers`
if (test ${#FICHIERS} -eq 0)
then return
fi
REP=`zenity --file-selection --directory --save --title="choix du répertoire de téléchargement : "`
if (test ${#REP} -eq 0)
then return
fi
if !(test -d "${REP}/${VERSION}")
then mkdir -p "${REP}/${VERSION}"
fi
nb_fichiers_a_telecharger=0
for i in ${FICHIERS}
do nb_fichiers_a_telecharger=`echo "${nb_fichiers_a_telecharger}+1" | bc`
done
pas=`echo "100/${nb_fichiers_a_telecharger}" | bc`
# progression=${pas}
progression=0
(
for i in ${FICHIERS}
# do echo "# ${REP}/${VERSION}/${i} en cours de téléchargement ..."
# do echo "# ${i},(distrib. ${MATURITE}), en cours de téléchargement (`echo "${progression}+1" | bc`/${nb_fichiers_a_telecharger}) ..."
do echo "# ${i},(distrib. ${MATURITE}), en cours de téléchargement (`echo "${progression}+1" | bc`% téléchargés) ..."
echo "${progression}"
if ([ $PROCESSEUR = ARM ])
then wget -P"${REP}/${VERSION}" -o"${REP}/${VERSION}/${i}.log" ${SITE}/NAS4Free-ARM/${VERSION}/${i}
fi
if ([ $PROCESSEUR = Intel_Amd ])
then if ([ $MATURITE = ALPHA ])
then wget -P"${REP}/${VERSION}" -o"${REP}/${VERSION}/${i}.log" ${SITE}/NAS4Free-Alpha/NAS4Free-${VERSION_MAJEURE}/${VERSION}/${i}
else if ([ $MATURITE = BETA ])
then wget -P"${REP}/${VERSION}" -o"${REP}/${VERSION}/${i}.log" ${SITE}/NAS4Free-Beta/NAS4Free-${VERSION_MAJEURE}/${VERSION}/${i}
else wget -P"${REP}/${VERSION}" -o"${REP}/${VERSION}/${i}.log" ${SITE}/NAS4Free-${VERSION_MAJEURE}/${VERSION}/${i}
fi
fi
fi
progression=`echo "${progression}+${pas}" | bc`
done
) | zenity --progress \
--title="telechargement du fichier :" \
--text="${progression} : ${REP}/${VERSION}/${i} (distrib. ${MATURITE})" \
--percentage=0 \
--auto-kill \
--auto-close
precautions
}
#====================================================================================
# intégrité
#====================================================================================
integrite()
{
REP=`zenity --file-selection --directory --save --title="choix du répertoire de la distribution : "`
if (test ${#REP} -eq 0)
then return
fi
ls ${REP}/NAS4Free* > ${TMP}/liste_fichiers.txt 2>/dev/null
ls ${REP}/readme.txt >> ${TMP}/liste_fichiers.txt 2>/dev/null
zenity --text-info \
--width=800 \
--height=300 \
--title="Liste des fichiers Nas4Free présents dans le répertoire ${REP} :" \
--no-wrap \
--filename=${TMP}/liste_fichiers.txt
nb_fichiers_a_controler=`cat ${TMP}/liste_fichiers.txt | egrep "*img|*iso" | wc -l`
pas=`echo "100/${nb_fichiers_a_controler}" | bc`
progression=${pas}
(
for architecture in x86 x64
do if (test -e ${REP}/*${architecture}*checksum)
then for i in *${architecture}*img.xz *${architecture}*img.gz *${architecture}*iso
do if test `ls -l ${REP}/${i} | wc -l 2>/dev/null` -ne 0
then for j in `ls ${REP}/${i}`
do k=`basename ${j}`
echo "# ${k}"
echo ${progression}
if [ `sha256sum ${j} | cut -f1 -d' '` = `cat ${REP}/NAS4Free-${architecture}-*.checksum | grep ${k} | cut -f4 -d' '` ]
then echo OK pour ${j} >> ${TMP}/integrite.txt
else echo !!! KO pour ${j} >> ${TMP}/integrite.txt
fi
progression=`echo "${progression}+${pas}" | bc`
done
fi
done
fi
done
) | zenity --progress \
--title="test d'intégrité du fichier :" \
--text="${progression} : ${k}" \
--percentage=0 \
--auto-close \
--auto-kill
if ((test -e ${REP}/NAS4Free-x86-*.checksum) || (test -e ${REP}/NAS4Free-x64-*.checksum))
then zenity --text-info \
--width=800 \
--height=250 \
--title="Résultats des tests d'intégrité pour les distributions trouvées dans le répertoire ${REP} :" \
--no-wrap \
--filename=${TMP}/integrite.txt
else zenity --warning \
--title="Problème :" \
--no-wrap \
--text="Absence de fichier checksum, impossible de tester l'intégrité des fichiers de distribution !"
fi
if test -f ${TMP}/liste_fichiers.txt
then rm ${TMP}/liste_fichiers.txt
fi
if test -f ${TMP}/integrite.txt
then rm ${TMP}/integrite.txt
fi
precautions
}
#-------------------------------------------------------------------------------
# A propos de Zenity
#-------------------------------------------------------------------------------
a_propos()
{
zenity --about
}
#===============================================================================
# Programme Principal
#===============================================================================
if !(test -d "/tmp")
then mkdir ./tmp
TMP="./tmp"
else TMP=/tmp
fi
VERSION=""
VERSION_MAJEURE=""
VERSION_MINEURE=""
#-------------------------------------------
# menu principal
#-------------------------------------------
liste_menu_principal="FALSE quitter quitte_l_application FALSE aide affiche_l_aide_de_l_application FALSE telecharger télécharge_une_distribution FALSE integrite vérifie_l_intégrité_d_une_distribution FALSE a_propos A_propos_de_zenity"
choix="A"
while ((test ${#choix} -gt 0) && [ $choix != quitter ])
do choix=`zenity --width=500 \
--height=250 \
--list \
--title="Accueil de l'utilitaire de téléchargement de Nas4Free" \
--radiolist \
--text="Sélectionnez l'option :" \
--column="Choix" \
--column="Options" \
--column="Informations" \
$liste_menu_principal`
if (test ${#choix} -gt 0)
then if ([ $choix != quitter ])
then ${choix}
fi
fi
done
#-------------------------------------------
if [ "$TMP" = "./tmp" ]
then rm -Rf ./tmp
fi
#set +x
11.2.0.4 - Omnius (revision 6026) x64-embedded
111909 RSDT1411 AMD Athlon(tm) 64 Processor 4000+ 4096MiB RAM - HDD 2 x 6 To in ZFS mirroring + 2 x (2 x 4To in ZFS mirroring) - SSD 32Go - UPS EATON Ellipse MAX 1100.
111909 RSDT1411 AMD Athlon(tm) 64 Processor 4000+ 4096MiB RAM - HDD 2 x 6 To in ZFS mirroring + 2 x (2 x 4To in ZFS mirroring) - SSD 32Go - UPS EATON Ellipse MAX 1100.
- mtiburs
- Forum Moderator

- Posts: 951
- Joined: 09 Aug 2012 23:34
- Location: France - Besançon
- Status: Offline
Re: Script de téléchargement et de checksum Nas4Free
C'est super !
En plus, je ne m'étais pas encore attardé sur Zenity (j'utilise dialog ... en mode texte)
Juste une petite suggestion, serait-il possible de proposer la décompression pour juste avoir le fichier .img à la fin ?
Merci pour ce script sympa !
En plus, je ne m'étais pas encore attardé sur Zenity (j'utilise dialog ... en mode texte)
Juste une petite suggestion, serait-il possible de proposer la décompression pour juste avoir le fichier .img à la fin ?
Merci pour ce script sympa !
Serveur Intel bi-Xéon P5530 / 8 X Ubuntu Serveur 18.04 LTS - ZFS-BTRFS-bcache / ~30 x PI2b(ARM) sous Nas4Free / et ...(chhhut)... 1 seul Xigmanas
... et pas à jour en plus
(çà craint)
Conception d'un "système bizarre"
de "super-devices-autonomes" en NFS gérés par des micro-serveurs SAN(+nas) sous N4F (11 super-devs en raidz3) taille actuelle: 16To / prévue: 64To / théorique: 320To (consommation < 15W en veille - 24/24h) en service depuis 2 ans.
Conception d'un "système bizarre"
- velivole18
- Forum Moderator

- Posts: 647
- Joined: 14 Jul 2012 20:23
- Location: France
- Status: Offline
Re: Script de téléchargement et de checksum Nas4Free
Bonsoir,
Y'a qu'à demander
Voici la version 0.4 ci-dessous.
Bon, c'est pas très beau car il faut sélectionner l'option de décompression tout en bas de la liste des fichiers comme si c'était un fichier à télécharger.
Je ferai mieux dans la version 0.5. Zenity ça à l'air bien tout de suite quand on découvre, mais à le pratiquer, c'est très contraignant, surtout dans ce que l'on veut voir s'afficher dans les fenêtres car les espaces ne sont pas admis dans les chaînes de caractères
Alors voici la version 0.4 :
Bonne soirée et allez les bleus (rugby France/Allblacks ce soir) 
Y'a qu'à demander
Voici la version 0.4 ci-dessous.
Bon, c'est pas très beau car il faut sélectionner l'option de décompression tout en bas de la liste des fichiers comme si c'était un fichier à télécharger.
Je ferai mieux dans la version 0.5. Zenity ça à l'air bien tout de suite quand on découvre, mais à le pratiquer, c'est très contraignant, surtout dans ce que l'on veut voir s'afficher dans les fenêtres car les espaces ne sont pas admis dans les chaînes de caractères
Alors voici la version 0.4 :
Code: Select all
#! /bin/sh
#====================================================================================
# nas4free-download.sh pour Linux
#-----------------------------------
#
# - version 0.2 du 25/10/2015 :
# Ajout de la possibilité de télécharger les distributions Beta et ARM de Nas4Free
#
# - version 0.3 du 26/11/2016 :
# Ajout de la possibilité de téécharger Nas4Free en version 11 (modif nom fichier readme et disparition des versions 32 bits)
#
# - version 0.4 du 26/11/2016
# Ajout de l'option de décompression des fichiers téléchargés qui ont comme préfixe .gz
# en cochant la dernière option à la fin de la liste des fichiers à télécharger
#
#====================================================================================
#set -x
#exec 2>/dev/null
#====================================================================================
# Précautions
#====================================================================================
precautions()
{
zenity --info \
--title="Informations :" \
--no-wrap \
--text="Faire une sauvegarde de la configuration de votre\nserveur actuel et lire le fichier readme.txt de la distribution avant\nd'installer une nouvelle version !"
}
#====================================================================================
# Aide
#====================================================================================
aide()
{
#-------------------------------------------
# affichage de l'aide sur ce shell
#-------------------------------------------
echo "<B><U>
Définition des options du menu d'accueil de nas4free-download.sh (version 0.4 du 26/11/2016) :</U></B><BR><BR>
<B><U>quitter</U></B> : quitte ce programme<BR><BR>
<B><U>aide</U></B> : affiche cette aide<BR><BR>
<B><U>télécharger</U></B> : télécharge une ou plusieurs distributions d'une version donnée<BR>
sont demandés :<BR>
- la version des distributions désirées (par exemple : 9.1.0.1.847)<BR>
- un répertoire de téléchargement<BR>
- les fichiers à télécharger correspondant à la version saisie<BR>
un répertoire nommé avec le numéro de version est créé dans le répertoire de téléchargement<BR>
puis le téléchargement s'effectue séquentiellement dans le répertoire créé sous le répertoire de téléchargement<BR>
un fichier log est créé dans le répertoire de la version téléchargée pour chaque fichier Nas4Free téléchargé<BR><BR>
<B><U>intégrité</U></B> : teste l'intégrité d'une ou plusieurs distributions<BR>
la présence du bon fichier *.checksum correspondant à la version et à l'architecture est obligatoire dans le répertoire testé<BR>
une liste de tous les fichiers présents dans le répertoire testé est affichée en premier lieu<BR>
ensuite les tests d'intégrité ont lieu et le résultat de ces tests est ensuite affiché<BR>
pour un fichier testé, une ligne de résultat commancant par OK indique que l'intégrité est correcte<BR>
pour un fichier testé, une ligne de résultat commancant par !!! KO indique que l'intégrité n'est pas correcte<BR><BR>
<B><U>à propos</U></B> : affiche l'à propos de zenity<BR><BR>
Pour contacter l'auteur \"velivole18\" ou faire des remarques sur ce script, rendez-vous sur le forum français de Nas4Free à l'adresse suivante :<BR>
http://forums.nas4free.org/viewforum.php?f=35" > ${TMP}/aide.html
zenity --text-info \
--width=1000 \
--height=500 \
--html \
--filename=${TMP}/aide.html
}
#====================================================================================
# Télécharger
#====================================================================================
telecharger()
{
SITE="http://freefr.dl.sourceforge.net/project/nas4free"
liste_types_processeurs="FALSE ARM Processeurs_de_la_famille_ARM FALSE Intel_Amd Processeur_de_la_famille_Intel_ou_Amd"
PROCESSEUR=`zenity --width=500 \
--height=250 \
--list \
--title="Choix de la famille de processeurs" \
--radiolist \
--text="Sélectionnez l'option :" \
--column="Choix" \
--column="Options" \
--column="Informations" \
$liste_types_processeurs`
if (test ${#PROCESSEUR} -eq 0)
then return
fi
liste_maturites="FALSE ALPHA version_ALPHA_de_la_distribution FALSE BETA version_BETA_de_la_distribution FALSE NORMALE version_NORMALE_de_la_distribution"
MATURITE=`zenity --width=500 \
--height=250 \
--list \
--title="Choix de la maturité de la distribution" \
--radiolist \
--text="Sélectionnez l'option :" \
--column="Choix" \
--column="Options" \
--column="Informations" \
$liste_maturites`
if (test ${#MATURITE} -eq 0)
then return
fi
VERSION=`zenity --entry --text="version de la distribution (par ex. 9.1.0.1.847) :" --entry-text=$VERSION`
VERSION_FREEBSD_LONG=`echo $VERSION | cut -d"." -f"-2"`
VERSION_FREEBSD_COURT=`echo $VERSION | cut -d"." -f"-1"`
VERSION_MAJEURE=`echo $VERSION | cut -d"." -f"-4"`
VERSION_MINEURE=`echo $VERSION | cut -d"." -f"5-"`
if (test ${#VERSION} -eq 0)
then return
fi
if ([ $PROCESSEUR = ARM ])
then liste_fichiers="FALSE NAS4Free-rpi2-embedded-${VERSION}.img.xz rpi2-embedded \
FALSE NAS4Free-rpi2-SD-${VERSION}.img rpi2-SD \
FALSE NAS4Free-rpi2-${VERSION}.checksum rpi2 \
FALSE NAS4Free-rpi-embedded-${VERSION}.img.xz rpi-embedded \
FALSE NAS4Free-rpi-SD-${VERSION}.img rpi-SD \
FALSE NAS4Free-oc1-embedded-${VERSION}.img.xz oc1-embedded \
FALSE NAS4Free-rpi-${VERSION}.checksum rpi \
FALSE NAS4Free-oc1-SD-${VERSION}.img oc1-SD \
FALSE NAS4Free-oc1-${VERSION}.checksum oc1_Checksum"
fi
if [ $PROCESSEUR = Intel_Amd -a "$VERSION_FREEBSD_COURT" -le 10 ]
then liste_fichiers="FALSE NAS4Free-x86-embedded-${VERSION}.img.xz x86_Embedded \
FALSE NAS4Free-x86-LiveUSB-${VERSION}.img.gz x86_LiveUSB \
FALSE NAS4Free-x86-LiveCD-${VERSION}.iso x86_LiveCD \
FALSE NAS4Free-x86-${VERSION}.checksum x86_Checksum \
FALSE NAS4Free-x64-embedded-${VERSION}.img.xz x64_Embedded\
FALSE NAS4Free-x64-LiveUSB-${VERSION}.img.gz x64_LiveUSB \
FALSE NAS4Free-x64-LiveCD-${VERSION}.iso x64_LiveCD \
FALSE NAS4Free-x64-${VERSION}.checksum x64_Checksum \
FALSE readme.txt Readme \
FALSE Décompression_automatique_fichier_gz Option"
fi
if [ $PROCESSEUR = Intel_Amd -a "$VERSION_FREEBSD_COURT" -gt 10 ]
then liste_fichiers="FALSE NAS4Free-x64-embedded-${VERSION}.img.xz x64_Embedded \
FALSE NAS4Free-x64-LiveUSB-${VERSION}.img.gz x64_LiveUSB \
FALSE NAS4Free-x64-LiveCD-${VERSION}.iso x64_LiveCD \
FALSE NAS4Free-x64-${VERSION}.checksum x64_Checksum \
FALSE readme_${VERSION_FREEBSD_LONG}.txt Readme \
FALSE Décompression_automatique_fichier_gz GUnzip"
fi
FICHIERS=`zenity --width=500 --height=400 --list --multiple --title="liste des fichiers de distributions à télécharger" --checklist --separator=" " --text="Sélectionnez les fichiers et option :" --column="Choix" --column="Fichiers" --column="Informations" $liste_fichiers`
if (test ${#FICHIERS} -eq 0)
then return
fi
REP=`zenity --file-selection --directory --save --title="choix du répertoire de téléchargement : "`
if (test ${#REP} -eq 0)
then return
fi
if !(test -d "${REP}/${VERSION}")
then mkdir -p "${REP}/${VERSION}"
fi
nb_fichiers_a_telecharger=0
for i in ${FICHIERS}
do if ([ ${i} != "Décompression_automatique_fichier_gz" ])
then nb_fichiers_a_telecharger=`echo "${nb_fichiers_a_telecharger}+1" | bc`
fi
done
pas=`echo "100/${nb_fichiers_a_telecharger}" | bc`
# progression=${pas}
progression=0
(
for i in ${FICHIERS}
# do echo "# ${REP}/${VERSION}/${i} en cours de téléchargement ..."
# do echo "# ${i},(distrib. ${MATURITE}), en cours de téléchargement (`echo "${progression}+1" | bc`/${nb_fichiers_a_telecharger}) ..."
do echo "# ${i},(distrib. ${MATURITE}), en cours de téléchargement (`echo "${progression}+1" | bc`% téléchargés) ..."
echo "${progression}"
if ([ $PROCESSEUR = ARM ])
then wget -P"${REP}/${VERSION}" -o"${REP}/${VERSION}/${i}.log" ${SITE}/NAS4Free-ARM/${VERSION}/${i}
fi
if ([ $PROCESSEUR = Intel_Amd ])
then if ([ $MATURITE = ALPHA ])
then wget -P"${REP}/${VERSION}" -o"${REP}/${VERSION}/${i}.log" ${SITE}/NAS4Free-Alpha/NAS4Free-${VERSION_MAJEURE}/${VERSION}/${i}
else if ([ $MATURITE = BETA ])
then wget -P"${REP}/${VERSION}" -o"${REP}/${VERSION}/${i}.log" ${SITE}/NAS4Free-Beta/NAS4Free-${VERSION_MAJEURE}/${VERSION}/${i}
else wget -P"${REP}/${VERSION}" -o"${REP}/${VERSION}/${i}.log" ${SITE}/NAS4Free-${VERSION_MAJEURE}/${VERSION}/${i}
fi
fi
fi
if ([ ${i} = "Décompression_automatique_fichier_gz" ])
then gunzip -kd ${REP}/${VERSION}/*.gz
fi
progression=`echo "${progression}+${pas}" | bc`
done
) | zenity --progress \
--title="telechargement du fichier :" \
--text="${progression} : ${REP}/${VERSION}/${i} (distrib. ${MATURITE})" \
--percentage=0 \
--auto-kill \
--auto-close
precautions
}
#====================================================================================
# intégrité
#====================================================================================
integrite()
{
REP=`zenity --file-selection --directory --save --title="choix du répertoire de la distribution : "`
if (test ${#REP} -eq 0)
then return
fi
ls ${REP}/NAS4Free* > ${TMP}/liste_fichiers.txt 2>/dev/null
ls ${REP}/readme.txt >> ${TMP}/liste_fichiers.txt 2>/dev/null
zenity --text-info \
--width=800 \
--height=300 \
--title="Liste des fichiers Nas4Free présents dans le répertoire ${REP} :" \
--no-wrap \
--filename=${TMP}/liste_fichiers.txt
nb_fichiers_a_controler=`cat ${TMP}/liste_fichiers.txt | egrep "*img|*iso" | wc -l`
pas=`echo "100/${nb_fichiers_a_controler}" | bc`
progression=${pas}
(
for architecture in x86 x64
do if (test -e ${REP}/*${architecture}*checksum)
then for i in *${architecture}*img.xz *${architecture}*img.gz *${architecture}*iso
do if test `ls -l ${REP}/${i} | wc -l 2>/dev/null` -ne 0
then for j in `ls ${REP}/${i}`
do k=`basename ${j}`
echo "# ${k}"
echo ${progression}
if [ `sha256sum ${j} | cut -f1 -d' '` = `cat ${REP}/NAS4Free-${architecture}-*.checksum | grep ${k} | cut -f4 -d' '` ]
then echo OK pour ${j} >> ${TMP}/integrite.txt
else echo !!! KO pour ${j} >> ${TMP}/integrite.txt
fi
progression=`echo "${progression}+${pas}" | bc`
done
fi
done
fi
done
) | zenity --progress \
--title="test d'intégrité du fichier :" \
--text="${progression} : ${k}" \
--percentage=0 \
--auto-close \
--auto-kill
if ((test -e ${REP}/NAS4Free-x86-*.checksum) || (test -e ${REP}/NAS4Free-x64-*.checksum))
then zenity --text-info \
--width=800 \
--height=250 \
--title="Résultats des tests d'intégrité pour les distributions trouvées dans le répertoire ${REP} :" \
--no-wrap \
--filename=${TMP}/integrite.txt
else zenity --warning \
--title="Problème :" \
--no-wrap \
--text="Absence de fichier checksum, impossible de tester l'intégrité des fichiers de distribution !"
fi
if test -f ${TMP}/liste_fichiers.txt
then rm ${TMP}/liste_fichiers.txt
fi
if test -f ${TMP}/integrite.txt
then rm ${TMP}/integrite.txt
fi
precautions
}
#-------------------------------------------------------------------------------
# A propos de Zenity
#-------------------------------------------------------------------------------
a_propos()
{
zenity --about
}
#===============================================================================
# Programme Principal
#===============================================================================
if !(test -d "/tmp")
then mkdir ./tmp
TMP="./tmp"
else TMP=/tmp
fi
VERSION=""
VERSION_MAJEURE=""
VERSION_MINEURE=""
#-------------------------------------------
# menu principal
#-------------------------------------------
liste_menu_principal="FALSE quitter quitte_l_application FALSE aide affiche_l_aide_de_l_application FALSE telecharger télécharge_une_distribution FALSE integrite vérifie_l_intégrité_d_une_distribution FALSE a_propos A_propos_de_zenity"
choix="A"
while ((test ${#choix} -gt 0) && [ $choix != quitter ])
do choix=`zenity --width=500 \
--height=250 \
--list \
--title="Accueil de l'utilitaire de téléchargement de Nas4Free - v0.4" \
--radiolist \
--text="Sélectionnez l'option :" \
--column="Choix" \
--column="Options" \
--column="Informations" \
$liste_menu_principal`
if (test ${#choix} -gt 0)
then if ([ $choix != quitter ])
then ${choix}
fi
fi
done
#-------------------------------------------
if [ "$TMP" = "./tmp" ]
then rm -Rf ./tmp
fi
#set +x11.2.0.4 - Omnius (revision 6026) x64-embedded
111909 RSDT1411 AMD Athlon(tm) 64 Processor 4000+ 4096MiB RAM - HDD 2 x 6 To in ZFS mirroring + 2 x (2 x 4To in ZFS mirroring) - SSD 32Go - UPS EATON Ellipse MAX 1100.
111909 RSDT1411 AMD Athlon(tm) 64 Processor 4000+ 4096MiB RAM - HDD 2 x 6 To in ZFS mirroring + 2 x (2 x 4To in ZFS mirroring) - SSD 32Go - UPS EATON Ellipse MAX 1100.
- mtiburs
- Forum Moderator

- Posts: 951
- Joined: 09 Aug 2012 23:34
- Location: France - Besançon
- Status: Offline
Re: Script de téléchargement et de checksum Nas4Free
j'ai essayé dans le script de faire un ALT+255 mais je ne sais pas comment m'y prendre.velivole18 wrote:... car les espaces ne sont pas admis dans les chaînes de caractères ...
normalement çà devrait faire un caractère invisible (ou alors ALT+160)
Je pense que çà doit être possible de trouver un caractère invisible pour faire les espaces tant recherchés
Serveur Intel bi-Xéon P5530 / 8 X Ubuntu Serveur 18.04 LTS - ZFS-BTRFS-bcache / ~30 x PI2b(ARM) sous Nas4Free / et ...(chhhut)... 1 seul Xigmanas
... et pas à jour en plus
(çà craint)
Conception d'un "système bizarre"
de "super-devices-autonomes" en NFS gérés par des micro-serveurs SAN(+nas) sous N4F (11 super-devs en raidz3) taille actuelle: 16To / prévue: 64To / théorique: 320To (consommation < 15W en veille - 24/24h) en service depuis 2 ans.
Conception d'un "système bizarre"
- mtiburs
- Forum Moderator

- Posts: 951
- Joined: 09 Aug 2012 23:34
- Location: France - Besançon
- Status: Offline
Re: Script de téléchargement et de checksum Nas4Free
t'as vu çà ?:
http://forum.ubuntu-fr.org/viewtopic.php?id=522511
http://forum.ubuntu-fr.org/viewtopic.php?id=522511
Serveur Intel bi-Xéon P5530 / 8 X Ubuntu Serveur 18.04 LTS - ZFS-BTRFS-bcache / ~30 x PI2b(ARM) sous Nas4Free / et ...(chhhut)... 1 seul Xigmanas
... et pas à jour en plus
(çà craint)
Conception d'un "système bizarre"
de "super-devices-autonomes" en NFS gérés par des micro-serveurs SAN(+nas) sous N4F (11 super-devs en raidz3) taille actuelle: 16To / prévue: 64To / théorique: 320To (consommation < 15W en veille - 24/24h) en service depuis 2 ans.
Conception d'un "système bizarre"
-
sleid
- PowerUser

- Posts: 774
- Joined: 23 Jun 2012 07:36
- Location: FRANCE LIMOUSIN CORREZE
- Status: Offline
Re: Script de téléchargement et de checksum Nas4Free
Ah, les quotes et doubles quotes, l'éternel casse tête.....non documenté en général!!
12.1.0.4 - Ingva (revision 7852)
FreeBSD 12.1-RELEASE-p12 #0 r368465M: Tue Dec 8 23:25:11 CET 2020
X64-embedded sur Intel(R) Atom(TM) CPU C2750 @ 2.40GHz Boot UEFI
ASRock C2750D4I 2 X 8GB DDR3 ECC
Pool of 2 vdev Raidz1: 3 WDC WD40EFRX + 3 WDC WD40EFRX
FreeBSD 12.1-RELEASE-p12 #0 r368465M: Tue Dec 8 23:25:11 CET 2020
X64-embedded sur Intel(R) Atom(TM) CPU C2750 @ 2.40GHz Boot UEFI
ASRock C2750D4I 2 X 8GB DDR3 ECC
Pool of 2 vdev Raidz1: 3 WDC WD40EFRX + 3 WDC WD40EFRX