ó
qxPXc           @   sI   d  Z  d d l Z d d l Z d d l Z d „  Z d „  Z d „  Z d S(   s°   Apport package hook for the ubiquity live CD installer.

Copyright (C) 2009 Canonical Ltd.
Authors: Colin Watson <cjwatson@ubuntu.com>,
         Brian Murray <brian@ubuntu.com>iÿÿÿÿNc         C   s²   t  j j d | ƒ r# d | } n' t  j j d | ƒ rF d | } n d  St  j | t  j ƒ r{ t | d ƒ j ƒ  |  | <n3 t  j j | ƒ r® t j j	 |  i d | | 6ƒ n  d  S(   Ns   /var/log/installer/%ss   /var/log/%st   rs   cat '%s'(
   t   ost   patht   existst   accesst   R_OKt   opent   readt   apportt	   hookutilst   attach_root_command_outputs(   t   reportt   identt   namet   f(    (    s2   /usr/share/apport/package-hooks/source_ubiquity.pyt   add_installation_log   s    c         C   s­  d } x |  j  d ƒ D]} | r¥ d | k r` | d k r` d j | j  d ƒ d ƒ d } q q¥ d | k r¥ | d k r¥ | d j | j  d ƒ d ƒ d 7} q q¥ n  | r¼ | d k r¼ | Sd | k rø | rø | d j | j  d ƒ d ƒ d 7} q n  d | k r1| r1d j | j  d ƒ d ƒ d } q n  t | j  d ƒ d ƒ d k rod	 | k ro| d k ro| Sn  d	 | k rq n  | d j | j  d ƒ d ƒ d 7} q Wd  S(
   Nt    s   
s   grub-installer:t    i   s"   Traceback (most recent call last):i   i   t	   Traceback(   t   splitt   joint   len(   t   syslogt   collect_grubt   collect_tracet   collectt   line(    (    s2   /usr/share/apport/package-hooks/source_ubiquity.pyt   prepare_duplicate_signature   s2     $	$ +c      
   C   s‡  t  |  d d ƒ |  d } d | k r‹ t j d | ƒ rl t j d | ƒ j d ƒ } t j d | | ƒ } n  | r‹ | j d ƒ t ‚ q‹ n  d | k r't j d	 | ƒ r't j d	 | ƒ j d ƒ } t d
 d | d g ƒ } d | k rÿ | j d ƒ t ‚ n  d | k r$| j d ƒ t ‚ q$q'n  d | k rI| j d ƒ t ‚ n  d | k rst j d | ƒ j d ƒ } n d  } | rŒ| |  d <n  d |  k rDt } t }	 d | k rÅd | k rÅt	 } n  d | k rÚt	 }	 n  |  d d k rð| s|  d d k r.|	 r.t
 | | |	 ƒ }
 |
 r.|
 |  d <q.n  | rDd |  d <qDn  t j d |  d ƒ } | rr| j d ƒ } n  |  j d d ƒ | r©|  d c d  | j ƒ  d! 7<n  t j d" |  d ƒ rÒ|  d c d# 7<n  t  |  d$ d% ƒ t j j d& ƒ r4| j d' ƒ } | d  k rt ‚ n  | r4t  |  d( d) ƒ q4n  t  |  d* d+ ƒ t  |  d, d- ƒ t  |  d. d/ ƒ d. |  k rƒ|  d c d0 7<n  d  S(1   Nt   UbiquitySyslogR   s   Buffer I/O error on devices   Attached .* CD-ROM (\w+)i   s   Buffer I/O error on device %ss¹  The system log from your installation contains an error.  The specific error commonly occurs when there is an issue with the media from which you were installing.  This can happen when your media is dirty or damaged or when you've burned the media at a high speed.  Please try cleaning the media and or burning new media at a lower speed.  In the event that you continue to encounter these errors it may be an issue with your CD / DVD drive.s   I/O error, devs   I/O error, dev (\w+)t   greps   %ss   /proc/mountst   targets›  The system log from your installation contains an error.  The specific error commonly occurs when there is an issue with the disk to which you are trying to install Ubuntu.  It is recommended that you back up important data on your disk and investigate the situation.  Measures you might take include cehcking cable connections for your disks and using software tools to investigate the health of your hardware.t   cdroms  The system log from your installation contains an error.  The specific error commonly occurs when there is an issue with the media from which you were installing.  Please try creating the USB stick you were installing from again or try installing from a different USB stick.s   SQUASHFS error: Unable to reads   Kernel command lines   Kernel command line: (.*)t   InstallCmdLineR   s8   grub-installer: Installation finished. No error reporteds   grub-installer:t   ProblemTypet   Bugt   DuplicateSignatures   grub-installert   SourcePackages   ubiquity.*Ubiquity (.*)
t   TagsR   s    ubiquity-%si    s+   UpgradeSystem\(\) was called with safe modes    ubiquity-upgradet   UbiquityPartmant   partmans   /var/log/installer/debugs­   The debug log file from your installation would help us a lot but includes the password you used for your user when installing Ubuntu.  Do you want to include this log file?t   UbiquityDebugt   debugt
   UbiquityDmt   dmt   Caspers
   casper.logt   OemConfigLogs   oem-config.logs    oem-config(   R   t   ret   searcht   groupt   informationt   StopIterationt   command_outputt   Nonet   Falset   TrueR   t
   setdefaultR   R   R   R   t   yesno(   R   t   uiR   t   cd_drivet   cd_errort
   error_diskt   mountt   install_cmdlineR   R   t   duplicate_signaturet   matcht   response(    (    s2   /usr/share/apport/package-hooks/source_ubiquity.pyt   add_info6   s~    
				!	(	   t   __doc__t   apport.hookutilsR   t   os.pathR   R.   R   R   RB   (    (    (    s2   /usr/share/apport/package-hooks/source_ubiquity.pyt   <module>   s   		