Dimensione: 4352
Commento:
|
Dimensione: 3953
Commento:
|
Le cancellazioni sono segnalate in questo modo. | Le aggiunte sono segnalate in questo modo. |
Linea 9: | Linea 9: |
Viene qui riportato il contenuto dello script, ricordando che il testo dovrà essere opportunamente modificato per ogni versione di Ubuntu. | Viene qui riportato il contenuto dello script, ricordando che a seconda della versione di Ubuntu possono essere necessarie alcune piccole modifiche: |
Linea 13: | Linea 14: |
from sys import argv | |
Linea 14: | Linea 16: |
ubuntu = "http://releases.ubuntu.com/16.04/MD5SUMS" kubuntu = "http://cdimage.ubuntu.com/kubuntu/releases/16.04/release/MD5SUMS" ubuntu_gnome = "http://cdimage.ubuntu.com/ubuntu-gnome/releases/16.04/release/MD5SUMS" ubuntu_mate = "http://cdimage.ubuntu.com/ubuntu-mate/releases/16.04/release/MD5SUMS" xubuntu = "http://cdimage.ubuntu.com/xubuntu/releases/16.04/release/MD5SUMS" lubuntu = "http://cdimage.ubuntu.com/lubuntu/releases/16.04/release/MD5SUMS" edubuntu = "http://cdimage.ubuntu.com/edubuntu/releases/16.04/release/MD5SUMS" ubuntustudio = "http://cdimage.ubuntu.com/ubuntustudio/releases/16.04/release/MD5SUMS" ubuntukylin = "http://cdimage.ubuntu.com/ubuntukylin/releases/16.04/release/MD5SUMS" mythbuntu = "http://cdimage.ubuntu.com/mythbuntu/releases/16.04/release/MD5SUMS" ubuntu_core = "http://cdimage.ubuntu.com/ubuntu-core/releases/16.04/release/MD5SUMS" server_powerpc = "http://cdimage.ubuntu.com/releases/16.04/release/MD5SUMS" |
script, version = argv def namestr(obj, namespace): return [name for name in namespace if namespace[name] is obj] UBUNTU = "http://releases.ubuntu.com/" + version + "/MD5SUMS" KUBUNTU = "http://cdimage.ubuntu.com/kubuntu/releases/" + version + "/release/MD5SUMS" UBUNTU_GNOME = "http://cdimage.ubuntu.com/ubuntu-gnome/releases/" + version + "/release/MD5SUMS" UBUNTU_MATE = "http://cdimage.ubuntu.com/ubuntu-mate/releases/" + version + "/release/MD5SUMS" XUBUNTU = "http://cdimage.ubuntu.com/xubuntu/releases/" + version + "/release/MD5SUMS" LUBUNTU = "http://cdimage.ubuntu.com/lubuntu/releases/" + version + "/release/MD5SUMS" EDUBUNTU = "http://cdimage.ubuntu.com/edubuntu/releases/" + version + "/release/MD5SUMS" UBUNTUSTUDIO = "http://cdimage.ubuntu.com/ubuntustudio/releases/" + version + "/release/MD5SUMS" UBUNTUKYLIN = "http://cdimage.ubuntu.com/ubuntukylin/releases/" + version + "/release/MD5SUMS" MYTHBUNTU = "http://cdimage.ubuntu.com/mythbuntu/releases/" + version + "/release/MD5SUMS" UBUNTU_CORE = "http://cdimage.ubuntu.com/ubuntu-core/releases/" + version + "/release/MD5SUMS" SERVER_POWERPC = "http://cdimage.ubuntu.com/releases/" + version + "/release/MD5SUMS" |
Linea 28: | Linea 35: |
for i in [ubuntu, kubuntu, ubuntu_gnome, ubuntu_mate, xubuntu, lubuntu, edubuntu, ubuntustudio, ubuntukylin, mythbuntu, ubuntu_core, server_powerpc]: web = urllib.request.urlopen(i) text = web.read().decode('utf_8') print(text) |
for i in [UBUNTU, KUBUNTU, UBUNTU_GNOME, UBUNTU_MATE, XUBUNTU, LUBUNTU, EDUBUNTU, UBUNTUSTUDIO, UBUNTUKYLIN, MYTHBUNTU, UBUNTU_CORE, SERVER_POWERPC]: variable = str((namestr(i, globals()))) variable = variable.replace("[", "") variable = variable.replace("]", "") variable = variable.replace("'", "") variable = variable.replace("i", "") variable = variable.replace(",", "") variable = variable.replace(" ", "") print(variable) print() web = urllib.request.urlopen(i) text = web.read().decode('utf_8') print(text) |
Linea 37: | Linea 53: |
0. Nella prima parte dello script sono riportati una serie di indirizzi web. Accertarsi che sia riportata la versione corretta di Ubuntu. Ad es. se si vuole eseguire lo script per '''Ubuntu 14.04''', nelle stringhe:{{{ ubuntu = "http://releases.ubuntu.com/16.04/MD5SUMS" kubuntu = "http://cdimage.ubuntu.com/kubuntu/releases/16.04/release/MD5SUMS" ecc.. }}}occorre sostituire '''16.04''' con '''14.04''', in modo che risultino:{{{ ubuntu = "http://releases.ubuntu.com/14.04/MD5SUMS" kubuntu = "http://cdimage.ubuntu.com/kubuntu/releases/14.04/release/MD5SUMS" ecc.. }}} 0. Per avviare lo script e ottenere la stampa delle hash md5 per le varianti di Ubuntu, digitare nel [[AmministrazioneSistema/RigaDiComando|terminale]] il comando{{{ python3 script.py |
0. Per ottenere la stampa delle hash md5 per le varianti di Ubuntu, occorre digitare nel [[AmministrazioneSistema/RigaDiComando|terminale]] un comando del tipo:{{{ python3 script.py VERSIONE_UBUNTU }}}sostituendo '''VERSIONE_UBUNTU''' con la versione desiderata. Ad esempio per la '''14.04''' il comando risulta:{{{ python3 script.py 14.04 |
Linea 50: | Linea 59: |
for i in [ubuntu, kubuntu, ubuntu_gnome, ubuntu_mate, xubuntu, lubuntu, edubuntu, ubuntustudio, ubuntukylin, mythbuntu, ubuntu_core, server_powerpc]: }}}sono riportate una o più varianti di Ubuntu non presenti in quella determinata versione. Ad es. nella 14.04 non é presente Ubuntu MATE. In tal caso basta togliere dalla lista '''ubuntu_mate''' in modo che risulti:{{{ for i in [ubuntu, kubuntu, ubuntu_gnome, xubuntu, lubuntu, edubuntu, ubuntustudio, ubuntukylin, mythbuntu, ubuntu_core, server_powerpc]: |
for i in [UBUNTU, KUBUNTU, UBUNTU_GNOME, UBUNTU_MATE, XUBUNTU, LUBUNTU, EDUBUNTU, UBUNTUSTUDIO, UBUNTUKYLIN, MYTHBUNTU, UBUNTU_CORE, SERVER_POWERPC]: }}}sono riportate una o più varianti di Ubuntu non presenti in quella determinata versione. Ad es. nella 14.04 non é presente Ubuntu MATE. In tal caso basta togliere dalla lista '''UBUNTU_MATE''' in modo che risulti:{{{ for i in [UBUNTU, KUBUNTU, UBUNTU_GNOME, XUBUNTU, LUBUNTU, EDUBUNTU, UBUNTUSTUDIO, UBUNTUKYLIN, MYTHBUNTU, UBUNTU_CORE, SERVER_POWERPC]: |
Linea 55: | Linea 64: |
= Adattamento del testo per il wiki = Prima del copia/incolla nella [[Installazione/MD5Sum/Hash|pagina wiki]], per migliorare la lettura inserire i nomi delle varianti di Ubuntu (Uubntu, Kubuntu, Xubuntu..) all'inizio di ogni blocco, in modo che risulti ad esempio:{{{ UBUNTU cab6dd5ee6d649ed1b24e807c877c0ae ubuntu-14.04.3-desktop-amd64.iso 0bc058cdc75fb75d4922c7c74c4cd6b1 ubuntu-14.04.3-desktop-i386.iso ecc.. KUBUNTU aefdc97d26e51066f5b50d36c5d4218c kubuntu-14.04-desktop-amd64.iso 327cf4202f8e2601ce0d772082c84b86 kubuntu-14.04-desktop-i386.iso ecc.. }}} Procedere con il copia/incolla sulla [[Installazione/MD5Sum/Hash|pagina wiki]]. |
0. Procedere quindi con il copia/incolla sulla [[Installazione/MD5Sum/Hash|pagina wiki]]. |
Introduzione
A ogni rilascio di una versione di Ubuntu è necessario aggiornare le hash md5 nella pagina Installazione/MD5Sum/Hash.
Per evitare di dover andare ad eseguire i copia/incolla da ogni singola pagina web, viene qui mostrato come utilizzare un comodo script in Python3 in modo da ottenerle tutte in un colpo.
Script
Viene qui riportato il contenuto dello script, ricordando che a seconda della versione di Ubuntu possono essere necessarie alcune piccole modifiche:
import urllib.request from sys import argv script, version = argv def namestr(obj, namespace): return [name for name in namespace if namespace[name] is obj] UBUNTU = "http://releases.ubuntu.com/" + version + "/MD5SUMS" KUBUNTU = "http://cdimage.ubuntu.com/kubuntu/releases/" + version + "/release/MD5SUMS" UBUNTU_GNOME = "http://cdimage.ubuntu.com/ubuntu-gnome/releases/" + version + "/release/MD5SUMS" UBUNTU_MATE = "http://cdimage.ubuntu.com/ubuntu-mate/releases/" + version + "/release/MD5SUMS" XUBUNTU = "http://cdimage.ubuntu.com/xubuntu/releases/" + version + "/release/MD5SUMS" LUBUNTU = "http://cdimage.ubuntu.com/lubuntu/releases/" + version + "/release/MD5SUMS" EDUBUNTU = "http://cdimage.ubuntu.com/edubuntu/releases/" + version + "/release/MD5SUMS" UBUNTUSTUDIO = "http://cdimage.ubuntu.com/ubuntustudio/releases/" + version + "/release/MD5SUMS" UBUNTUKYLIN = "http://cdimage.ubuntu.com/ubuntukylin/releases/" + version + "/release/MD5SUMS" MYTHBUNTU = "http://cdimage.ubuntu.com/mythbuntu/releases/" + version + "/release/MD5SUMS" UBUNTU_CORE = "http://cdimage.ubuntu.com/ubuntu-core/releases/" + version + "/release/MD5SUMS" SERVER_POWERPC = "http://cdimage.ubuntu.com/releases/" + version + "/release/MD5SUMS" for i in [UBUNTU, KUBUNTU, UBUNTU_GNOME, UBUNTU_MATE, XUBUNTU, LUBUNTU, EDUBUNTU, UBUNTUSTUDIO, UBUNTUKYLIN, MYTHBUNTU, UBUNTU_CORE, SERVER_POWERPC]: variable = str((namestr(i, globals()))) variable = variable.replace("[", "") variable = variable.replace("]", "") variable = variable.replace("'", "") variable = variable.replace("i", "") variable = variable.replace(",", "") variable = variable.replace(" ", "") print(variable) print() web = urllib.request.urlopen(i) text = web.read().decode('utf_8') print(text)
Utilizzo
Aprire un editor di testo, incollare il testo dello script riportato nel paragrafo precedente e salvare il file nella propria Home con il nome script.py
Per ottenere la stampa delle hash md5 per le varianti di Ubuntu, occorre digitare nel terminale un comando del tipo:
python3 script.py VERSIONE_UBUNTU
sostituendo VERSIONE_UBUNTU con la versione desiderata. Ad esempio per la 14.04 il comando risulta:
python3 script.py 14.04
Se lo script si ferma con dei messaggi di errore, vuol dire che nella sezione:
for i in [UBUNTU, KUBUNTU, UBUNTU_GNOME, UBUNTU_MATE, XUBUNTU, LUBUNTU, EDUBUNTU, UBUNTUSTUDIO, UBUNTUKYLIN, MYTHBUNTU, UBUNTU_CORE, SERVER_POWERPC]:
sono riportate una o più varianti di Ubuntu non presenti in quella determinata versione. Ad es. nella 14.04 non é presente Ubuntu MATE. In tal caso basta togliere dalla lista UBUNTU_MATE in modo che risulti:
for i in [UBUNTU, KUBUNTU, UBUNTU_GNOME, XUBUNTU, LUBUNTU, EDUBUNTU, UBUNTUSTUDIO, UBUNTUKYLIN, MYTHBUNTU, UBUNTU_CORE, SERVER_POWERPC]:
- Una volta eliminate le varianti non comprese, lo script terminerà la stampa delle hash md5 senza riportare errori.
Procedere quindi con il copia/incolla sulla pagina wiki.