~burhanilinux/+junk/plymouth

« back to all changes in this revision

Viewing changes to debian/source_plymouth.apport

  • Committer: Juzer Dana
  • Date: 2024-01-14 13:03:08 UTC
  • Revision ID: juzerdana@gmail.com-20240114130308-urizjbjhjqmenga6
New Commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'''apport package hook for plymouth
 
2
 
 
3
Copyright 2010 Canonical Ltd.
 
4
Authors: Steve Langasek <steve.langasek@ubuntu.com>,
 
5
         Brian Murray <brian@ubuntu.com>
 
6
'''
 
7
 
 
8
from apport.hookutils import *
 
9
 
 
10
import os.path
 
11
 
 
12
 
 
13
def _attach_file_filtered(report, path, key=None):
 
14
    '''filter out password from grub configuration'''
 
15
    if not key:
 
16
        key = path_to_key(path)
 
17
 
 
18
    if os.path.exists(path):
 
19
        with open(path,'r') as f:
 
20
            filtered = [l if not l.startswith('password')
 
21
                        else '### PASSWORD LINE REMOVED ###'
 
22
                        for l in f.readlines()]
 
23
            report[key] = ''.join(filtered)
 
24
 
 
25
 
 
26
def add_info(report):
 
27
    attach_hardware(report)
 
28
    attach_file(report, '/proc/fb', 'ProcFB')
 
29
    attach_file(report, '/proc/cmdline', 'ProcCmdLine')
 
30
    attach_file(report, '/var/log/boot.log', 'BootLog')
 
31
    debug_log = '/var/log/plymouth-debug.log'
 
32
    if os.path.exists(debug_log):
 
33
        attach_root_command_outputs(report,
 
34
            {'PlymouthDebug': 'cat %s' % debug_log})
 
35
    _attach_file_filtered(report, '/etc/default/grub', 'EtcDefaultGrub')
 
36
    default_alternative = '/etc/alternatives/default.plymouth'
 
37
    if os.path.exists(default_alternative):
 
38
        report['DefaultPlymouth'] = command_output(['readlink', default_alternative])
 
39
    text_alternative = '/etc/alternatives/text.plymouth'
 
40
    if os.path.exists(text_alternative):
 
41
        report['TextPlymouth'] = command_output(['readlink', text_alternative])