Dimensione: 3532
Commento:
|
Dimensione: 2907
Commento:
|
Le cancellazioni sono segnalate in questo modo. | Le aggiunte sono segnalate in questo modo. |
Linea 1: | Linea 1: |
## page was renamed from GruppoDocumentazione/NuovoRilascio/ScriptHash | |
Linea 17: | Linea 18: |
Linea 18: | Linea 20: |
Linea 21: | Linea 22: |
def namestr(obj, namespace): var = str([name for name in namespace if namespace[name] is obj]) for char in "['i, ']": var = var.replace(char, '') return var UBUNTU = "http://releases.ubuntu.com/" + ubu_version + "/MD5SUMS" KUBUNTU = "http://cdimage.ubuntu.com/kubuntu/releases/" + ubu_version + "/release/MD5SUMS" UBUNTU_GNOME = "http://cdimage.ubuntu.com/ubuntu-gnome/releases/" + ubu_version + "/release/MD5SUMS" UBUNTU_MATE = "http://cdimage.ubuntu.com/ubuntu-mate/releases/" + ubu_version + "/release/MD5SUMS" XUBUNTU = "http://cdimage.ubuntu.com/xubuntu/releases/" + ubu_version + "/release/MD5SUMS" LUBUNTU = "http://cdimage.ubuntu.com/lubuntu/releases/" + ubu_version + "/release/MD5SUMS" EDUBUNTU = "http://cdimage.ubuntu.com/edubuntu/releases/" + ubu_version + "/release/MD5SUMS" UBUNTUSTUDIO = "http://cdimage.ubuntu.com/ubuntustudio/releases/" + ubu_version + "/release/MD5SUMS" UBUNTUKYLIN = "http://cdimage.ubuntu.com/ubuntukylin/releases/" + ubu_version + "/release/MD5SUMS" MYTHBUNTU = "http://cdimage.ubuntu.com/mythbuntu/releases/" + ubu_version + "/release/MD5SUMS" UBUNTU_CORE = "http://cdimage.ubuntu.com/ubuntu-core/releases/" + ubu_version + "/release/MD5SUMS" SERVER_POWERPC = "http://cdimage.ubuntu.com/releases/" + ubu_version + "/release/MD5SUMS" for i in [UBUNTU, KUBUNTU, UBUNTU_GNOME, UBUNTU_MATE, XUBUNTU, LUBUNTU, EDUBUNTU, UBUNTUSTUDIO, UBUNTUKYLIN, MYTHBUNTU, UBUNTU_CORE, SERVER_POWERPC]: print(namestr(i, globals())) #Stampa il nome della variante di Ubuntu request = requests.get(i) |
def print_hash(web_page): request = requests.get(web_page) |
Linea 44: | Linea 25: |
web = urllib.request.urlopen(i) | web = urllib.request.urlopen(web_page) |
Linea 46: | Linea 27: |
print(text) #Stampa delle hash (se la pagina/variante di ubuntu esiste) | print(text) #Stampa delle hash, se la pagina della variante di ubuntu esiste |
Linea 49: | Linea 30: |
#STAMPA HASH UBUNTU PRESENTI IN http://releases.ubuntu.com/ print("UBUNTU") link = "http://releases.ubuntu.com/" + ubu_version + "/MD5SUMS" print_hash(link) #STAMPA HASH VARIANTI *BUNTU PRESENTI IN http://cdimage.ubuntu.com/ for i in ["kubuntu", "ubuntu-gnome", "ubuntu-mate", "xubuntu", "lubuntu", "ubuntu-budgie", "ubuntustudio", "ubuntukylin", "mythbuntu"]: link = "http://cdimage.ubuntu.com/" + i + "/releases/" + ubu_version + "/release/MD5SUMS" print(i.upper()) #nome in maiuscolo print_hash(link) #STAMPA HASH VERSIONI SERVER PRESENTI IN http://cdimage.ubuntu.com/releases/ print("SERVER_POWERPC") link = "http://cdimage.ubuntu.com/releases/" + ubu_version + "/release/MD5SUMS" print_hash(link) |
|
Linea 53: | Linea 50: |
0. Aprire un [[Ufficio/EditorDiTesto|editor di testo]], incollare il testo dello script riportato nel paragrafo precedente e salvare il file nella propria '''Home''' con il nome `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 }}}Per ogni variante di Ubuntu verranno stampate le hash md5. Nel caso una variante non fosse presente (ad es. nella 14.04 non è presente Ubuntu MATE), verrà segnalata come "assente". 0. Procedere quindi con il copia/incolla del testo sulla [[Installazione/MD5Sum/Hash|pagina wiki]]. |
0. Aprire un [[Ufficio/EditorDiTesto|editor di testo]], incollare il testo dello script riportato nel paragrafo precedente e salvare il file nella propria '''Home''' con il nome `scriptmd5sum.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 scriptmd5sum.py VERSIONE_UBUNTU }}}sostituendo '''VERSIONE_UBUNTU''' con la versione desiderata. Ad esempio per la '''16.04''' il comando risulta:{{{ python3 scriptmd5sum.py 16.04 }}}Per ogni variante di Ubuntu verranno stampate le '''hash md5'''. Nel caso una variante non fosse presente (ad es. nella 16.04 non è presente Edbuntu), verrà segnalata come ''assente''. 0. Procedere quindi con il copia/incolla del testo sulla [[Installazione/MD5Sum/Hash|pagina wiki]], eliminando le varianti ''assenti''. |
Problemi in questa pagina? Segnalali in questa discussione
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:
import urllib.request import requests from sys import argv script, ubu_version = argv def print_hash(web_page): request = requests.get(web_page) if request.status_code == 200: #Controlla che la pagina delle hash sia esistente web = urllib.request.urlopen(web_page) text = web.read().decode('utf_8') print(text) #Stampa delle hash, se la pagina della variante di ubuntu esiste else: print("Non presente!\n") #STAMPA HASH UBUNTU PRESENTI IN http://releases.ubuntu.com/ print("UBUNTU") link = "http://releases.ubuntu.com/" + ubu_version + "/MD5SUMS" print_hash(link) #STAMPA HASH VARIANTI *BUNTU PRESENTI IN http://cdimage.ubuntu.com/ for i in ["kubuntu", "ubuntu-gnome", "ubuntu-mate", "xubuntu", "lubuntu", "ubuntu-budgie", "ubuntustudio", "ubuntukylin", "mythbuntu"]: link = "http://cdimage.ubuntu.com/" + i + "/releases/" + ubu_version + "/release/MD5SUMS" print(i.upper()) #nome in maiuscolo print_hash(link) #STAMPA HASH VERSIONI SERVER PRESENTI IN http://cdimage.ubuntu.com/releases/ print("SERVER_POWERPC") link = "http://cdimage.ubuntu.com/releases/" + ubu_version + "/release/MD5SUMS" print_hash(link)
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 scriptmd5sum.py
Per ottenere la stampa delle hash md5 per le varianti di Ubuntu, occorre digitare nel terminale un comando del tipo:
python3 scriptmd5sum.py VERSIONE_UBUNTU
sostituendo VERSIONE_UBUNTU con la versione desiderata. Ad esempio per la 16.04 il comando risulta:
python3 scriptmd5sum.py 16.04
Per ogni variante di Ubuntu verranno stampate le hash md5. Nel caso una variante non fosse presente (ad es. nella 16.04 non è presente Edbuntu), verrà segnalata come assente.
Procedere quindi con il copia/incolla del testo sulla pagina wiki, eliminando le varianti assenti.