~brian-murray/ubuntu/oneiric/apport/ubiquity-dupe-sig

« back to all changes in this revision

Viewing changes to data/package-hooks/source_debian-installer.py

  • Committer: Steve Langasek
  • Date: 2011-08-04 20:49:32 UTC
  • mfrom: (1809.1.1 debian-installer-hook)
  • Revision ID: steve.langasek@canonical.com-20110804204932-alwr7a6lywlc56jb
Tags: 1.21.2-0ubuntu10
mergeĀ fromĀ Brian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
'''Apport package hook for the Debian installer.
2
2
 
3
 
Copyright (C) 2009 Canonical Ltd.
4
 
Author: Colin Watson <cjwatson@ubuntu.com>'''
5
 
 
6
 
from apport.hookutils import attach_hardware, command_available, command_output
 
3
Copyright (C) 2011 Canonical Ltd.
 
4
Authors: Colin Watson <cjwatson@ubuntu.com>,
 
5
         Brian Murray <brian@ubuntu.com>'''
 
6
 
 
7
import os
 
8
from apport.hookutils import attach_hardware, command_available, command_output, attach_root_command_outputs
 
9
 
 
10
 
 
11
def add_installation_log(report, ident, name):
 
12
    if os.path.exists('/var/log/installer/%s' % name):
 
13
        f = '/var/log/installer/%s' % name
 
14
    elif os.path.exists('/var/log/%s' % name):
 
15
        f = '/var/log/%s' % name
 
16
    else:
 
17
        return
 
18
 
 
19
    if os.access(f, os.R_OK):
 
20
        report[ident] = (f,)
 
21
    else:
 
22
        attach_root_command_outputs(report,
 
23
            {ident: "cat '%s'" % f})
 
24
 
7
25
 
8
26
def add_info(report):
9
27
    attach_hardware(report)
28
46
    except IOError:
29
47
        pass
30
48
 
 
49
    add_installation_log(report, 'DIPartman', 'partman')
 
50
    add_installation_log(report, 'DISyslog', 'syslog')
 
51
 
 
52
 
31
53
if __name__ == '__main__':
32
54
    report = {}
33
55
    add_info(report)