For desktop installations, which are probably the most common, I have
found the following code useful to extract the disk information from the
casper.log:

        # Found label 'Ubuntu 8.04.1 _Hardy Heron_ - Release amd64 (20080702.1)'
        distributor_regex = r"(?P<distributor>[\w\-]+)"
        release_regex = r"(?P<release>[\d\.]+)"
        codename_regex = r"(?P<codename>[^_]+)"
        official_regex = r"(?P<official>[\w ]+)"
        architecture_regex = r"(?P<architecture>[\w\+]+)"
        type_regex = r"(?P<type>Binary-\d+)"
        date_regex = r"(?P<date>[^\)]+)"

        info_regex = r"%s %s _%s_ - %s %s (%s )?\(%s\)" % (distributor_regex,
            release_regex, codename_regex, official_regex, architecture_regex,
            type_regex, date_regex)
        line_regex = r"Found label '%s'" % info_regex
        line_pattern = re.compile(line_regex)

        file = open("/var/log/installer/casper.log")
        for line in file.readlines():
            match = line_pattern.match(line)
            if match:
                print match.group("codename")

-- 
Please include installation media build number in installation logs
https://bugs.launchpad.net/bugs/364649
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to