Wiki Ubuntu-it

Indice
Partecipa
FAQ
Wiki Blog
------------------
Ubuntu-it.org
Forum
Chiedi
Chat
Cerca
Planet
  • Pagina non alterabile
  • Informazioni
  • Allegati
  • Differenze per "GruppoDocumentazione/NuovoRilascio/ScriptHashMD5Sum"
Differenze tra le versioni 5 e 9 (in 4 versioni)
Versione 5 del 21/02/2016 03.23.45
Dimensione: 3951
Autore: jeremie2
Commento:
Versione 9 del 22/03/2016 02.51.57
Dimensione: 3951
Autore: jeremie2
Commento:
Le cancellazioni sono segnalate in questo modo. Le aggiunte sono segnalate in questo modo.
Linea 1: Linea 1:
<<BR>>
Linea 2: Linea 3:
<<Informazioni(forum=http://forum.ubuntu-it.org/viewtopic.php?t=473952;)>>
Linea 16: Linea 18:
script, version = argv script, ubu_version = argv
Linea 19: Linea 21:
    return [name for name in namespace if namespace[name] is obj]     var = str([name for name in namespace if namespace[name] is obj])
    for char in "['i, ']":
        var = var.replace(char, '')
    return var
Linea 21: Linea 26:
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"
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"
Linea 35: Linea 40:
    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()
    ubuntu_flavour = namestr(i, globals())
    print(ubuntu_flavour, "\n")
Linea 59: Linea 57:
}}}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:{{{ }}}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''' (''togliere anche la virgola!'') in modo che risulti:{{{


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, ricordando che a seconda della versione di Ubuntu possono essere necessarie alcune piccole modifiche:

import urllib.request
from sys import argv

script, ubu_version = argv

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]:
    ubuntu_flavour = namestr(i, globals())
    print(ubuntu_flavour, "\n")
    web = urllib.request.urlopen(i)
    text = web.read().decode('utf_8')
    print(text)

Utilizzo

  1. 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

  2. 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
  3. 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 (togliere anche la virgola!) in modo che risulti:

    for i in [UBUNTU, KUBUNTU, UBUNTU_GNOME, XUBUNTU, LUBUNTU, EDUBUNTU, UBUNTUSTUDIO, UBUNTUKYLIN, MYTHBUNTU, UBUNTU_CORE, SERVER_POWERPC]:
  4. Una volta eliminate le varianti non comprese, lo script terminerà la stampa delle hash md5 senza riportare errori.
  5. Procedere quindi con il copia/incolla sulla pagina wiki.

Ulteriori risorse


CategoryComunitaDocumentazione