ó J¡Vc @sŸ ddlmZdZdZdZdZddlZddlZddlZddl Z ddl Z ddl Tddl m Z mZmZmZdd lmZdd lmZmZddlTd Zd Zd ZdZeeZdZdZiZd„Zd„Z d„Z!dd„Z"d„Z#edde$fdedde$fdedde$fddde%fddde%fe j&e j'e j(e j)e j*g Z+ypej,eeeee+e-fd e$d!e$ƒZ.e.j/d"d#d$d%d&d'd(d)gd*e%ƒ\Z0Z1Z2Z3Z4Z5Wn-ej6k r:Z7e8j9e7j:ƒe"ƒnXej;d+ƒrZe8j<d(ƒnxóe0D]ë\Z=Z>e=dxkrƒe"ƒqae=d.krœe"d/ƒqae=d0krµe"d1ƒqae=d2kráe?ed3d4ƒe@d5e%ƒqae=dykre>jAƒjBƒZCe8j<eCƒsLe"ƒqLqae=dzkr7e8j<d(ƒqae=d:krae>ZqaqaWejDƒd5kr|e8j9d;ƒejEƒnesïed<gd=eƒZFeeFjGƒd5ƒZHeHrÉeHjId4ƒd5Znesïe8j9d>ƒejEd?ƒqïnejJjKeƒs d@ZndAeZLe8jMdBeLƒe jNeLƒ\ZOZPeOd5krge8j9dCeƒejEd?ƒne jNdDeƒ\ZOZPeOd5kr e8j9dEeƒndFedGee %ssFailed to clear the %s log filetgzips gzip %s.%ds$Existing %s log file copied to %s.%ds'Existing %s log file copied to %s.%d.gz( R R$R'RRRRRtexecuteR-R#tinfo(tstrLogtiArchR*R+R)((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/logcapture.pytbackup_clearLog’s";"    tnames-Usage: [su -c /sudo] %s [USER INFO] [OPTIONS]tsummaryse.g. su -c '%s's [USER INFO]theadings)User name for which logs to be collected:s--user= toptiontrun_as_root_oktquietshl:g:rthelps help-restshelp-mans help-descslogging=Rsuser=thandle_device_printert HPLIP_DEBUGs-hs--helps --help-resttrests --help-mantmans --help-desctendt is-ls --loggings-gs--debugs--usersIlogCapture needs root permissions since cups service restart requires....twhotstdoutsAFailed to get the user name. Try again by passing '--user' optionis/tmps mkdir -p %ss"Creating temporary logs folder =%ss'Failed to create directory =%s. Exitings chmod 755 %ss$Failed to change permissions for %s.s/home/s/.hplips /root/.hpliptrootsmkdir -p %s/%sschmod 755 %s/%ss'Failed to change permissions for %s/%s.sVArchiving system logs (i.e. syslog, message, error_log). Press (y=yes*, n=no, q=quit):tytntqs User exits/var/log/syslogs/var/log/messagess/var/log/cups/error_logs%Y-%m-%d %H:%M:%SsT Please perform the tasks (Print, scan, fax) for which you need to collect the logs.s1Are you done with tasks?. Press (y=yes*, q=quit):shp-checksFailed to run hp-check commands$Copying logs to Temporary folder =%ss#cp -f /var/log/syslog %s/syslog.logsFailed to capture %s log file.s'cp -f /var/log/messages %s/messages.logs3cp -f /var/log/cups/error_log %s/cups_error_log.logs(Collecting cups logs from system journals+journalctl -u cups.service -e --since '%s' s> %s/cups_error.logs#Failed to capture logs from journals'Collecting messages from system journalsjournalctl --since '%s' s> %s/messages.logs'Failed to capture messages from journals!cp -f %s/*.log %s/%s 2>/devnull smv -f ./hp-check.log %ssFailed to capture %s log files.s./hp-check.logschmod 666 %s/*.logstar -zcf %s.tar.gz %ssCompressing logs. cmd =%ssFailed to compress %s folder.s$Changing Permissions of ./%s.tar.gz schmod 666 -R ./%s.tar.gzs+Failed to change permissions for %s.tar.gz.sRemoving Temporary log files..s rm -rf %ss2Failed to remove temporary files. Remove manually.sLogs are saved as %s/%s.tar.gzsXPlease create a bug @https://bugs.launchpad.net/hplip/+filebug and upload this log file.sLogs are saved as %s/%s(s-hs--help(s-ls --logging(s-gs--debug(_t __future__RR2R1R5t__doc__R R6tgetopttglobtdatetimetbase.gtbaseRRRRt base.sixextRt subprocessRRtinstaller.core_installRRtLOG_FOLDER_PATHtLOG_FOLDER_NAMEt LOG_FILEStTMP_DIRt USER_NAMEtUSERSRR,R.R9R?RRt USAGE_OPTIONSt USAGE_HELPtUSAGE_LOGGING1tUSAGE_LOGGING2tUSAGE_LOGGING3R4tModuleRtmodt parseStdOptstoptst device_urit printer_nametmodet ui_toolkittloct GetoptErrorteRRtmsgtgetenvt set_leveltotatprintt clean_exittlowertstript log_leveltgetuidR7tpoutt communicatetoutputtsplitR$R'R)RRR*R+tut enter_choicetokt user_inputR-tstrftimetnowtlog_timeR<tboldR!R;t sts_compresstgetcwd(((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/logcapture.pytsX      "    ( !  C                         $   !             $          &&