;ς
Aβ?c           @   sΘ  d  Z  d k Z d k Z d k Z d k Z d k l Z l Z d k Z d k	 Z	 d k
 Z
 d k Z d d d d g Z d g Z d g Z d	 g Z d
 a d k Z d k l Z l Z d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d   Z" d   Z# d
 e$ d   Z% d
 e$ d!  Z& e' d" j o!d k Z d k Z d k( Z( d k) Z) e$ Z* e i+ d# Z, y+ e( i( e, d$ d% d& d' d( g  \ Z- Z. Wn. e( i/ j
 o Z0 d) e0 GHe i1 d#  n Xd
 Z2 d
 Z3 e- GHx e- D] Z4 e4 d
 d* j p e4 d
 d+ j o d# Z2 e4 d# Z5 n e4 d
 d, j p e4 d
 d- j o
 d# Z3 n e4 d
 d. j o e4 d# Z* qNqNWd/ d0 f d1 d2 f d3 d4 f d5 d6 f g Z6 d5 d6 f d1 d2 f d3 d4 f d/ d0 f g Z7 d5 d6 f g Z8 d3 d4 f d5 d6 f g Z9 d7 d6 f d8 d0 f g Z: d9 d6 f d: d4 f g Z; d; d6 f g Z< d< e* GHe) i& e< d= e* d> d# GHe i1   n d S(?   s0   Module for munging lilo.conf lilo configurationsN(   s   _s   N_s   labels   roots   appends   videos	   read-onlys   initrds   aliasi    (   s   Errors
   makeInitrds   LiloConfErrorc           B   s   t  Z d   Z RS(   Nc         C   s4   t  d  |  i } t i   } | i |  | Sd  S(   Ns-   Error installing lilo.conf  The message was:
(   s   _s   selfs   errmsgs   msgs
   up2dateLogs   initLogs   logs   log_me(   s   selfs   msgs   log(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   __repr__,   s    (   s   __name__s
   __module__s   __repr__(    (    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   LiloConfError+   s   s   LiloConfRestoreErrorc           B   s   t  Z d   Z RS(   Nc         C   s4   t  d  |  i } t i   } | i |  | Sd  S(   Ns9   Error restoring the backup of lilo.conf  The backup was:
(   s   _s   selfs   errmsgs   msgs
   up2dateLogs   initLogs   logs   log_me(   s   selfs   msgs   log(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   __repr__3   s    (   s   __name__s
   __module__s   __repr__(    (    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   LiloConfRestoreError2   s   s   LiloInstallErrorc           B   s   t  Z d   Z RS(   Nc         C   s4   t  d  |  i } t i   } | i |  | Sd  S(   Ns&   Error installing the new bootloader: 
(   s   _s   selfs   errmsgs   msgs
   up2dateLogs   initLogs   logs   log_me(   s   selfs   msgs   log(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   __repr__:   s    (   s   __name__s
   __module__s   __repr__(    (    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   LiloInstallError9   s   s   LiloConfReadErrorc           B   s   t  Z d   Z RS(   Nc         C   s   t  d  |  i } | Sd  S(   Ns+   Error reading lilo.conf: The messages was:
(   s   _s   selfs   errmsgs   msg(   s   selfs   msg(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   __repr__A   s    (   s   __name__s
   __module__s   __repr__(    (    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   LiloConfReadError@   s   s   LiloConfParseErrorc           B   s   t  Z d   Z RS(   Nc         C   s   t  d  |  i } | Sd  S(   Ns   lilo options that are not supported by up2date are used in the default lilo.conf. This file will not be modified. The options include:
(   s   _s   selfs   errmsgs   msg(   s   selfs   msg(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   __repr__G   s    (   s   __name__s
   __module__s   __repr__(    (    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   LiloConfParseErrorF   s   c         C   s-   y |  i |  Wn t j
 o	 } n Xd  S(   N(   s   configs   delImages   oldImages
   IndexErrors   e(   s   configs   oldImages   default_images   default_types   e(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   removeImageL   s    c         C   sG  d |  }	 t i d d d |	  } x8 t D]0 } | i |  } | o | i
 | |  q) q) W| i   }
 t t t t } h  } x3 |
 i   D]% } | | j o q |
 | | | <q Wx t D] } | i
 |  qΎ Wx( | i   D] } | i
 | | |  qβ W| o | i
 d |  n | o | i
 d |  n | i |  d  S(   Ns   /boot/vmlinuz-%ss	   imageTypes   images   paths   initrds   label(   s   newimages   paths   lilos   LiloConfigFiles   sls   list_of_directivess   is   default_images   getEntrys   tmps   addEntrys   listEntriess   entriess   default_directivess   other_directivess   ignore_directivess   known_directivess   tmp_entriess   keyss   initrds   labels   configs   addImage(   s   newimages   initrds   labels   configs   default_images   tmps   is   sls   known_directivess   paths   entriess   tmp_entries(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   addImageZ   s4    
    c         C   sΨ   t  i   } d  k } d  k } | i t i d  | i  } y% | i	 d |  | i d |  Wn t d   n Xt o |  i d d | n; y$ |  i d d | | i d  Wn t d   n X| Sd  S(   Ns   /etc/lilo.confs,   making a backup copy of /etc/lilo.conf as %ss+   unable to create a backup copy of lilo.confs   /tmp/lilo.confs   permss"   writing out the new /etc/lilo.confs   Unable to write out lilo.conf(   s
   up2dateLogs   initLogs   logs   shutils   stats   S_IMODEs   oss   ST_MODEs	   lilopermss   copys
   backupfiles   log_mes   LiloConfErrors   TESTs   configs   write(   s   configs
   backupfiles   stats   logs	   lilopermss   shutil(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   installLiloConfig   s"    		c         C   sr   t  i   } t o d  Sn d  k } y' | i |  d  } | i d |   Wn t	 |    n Xt
 i |   d  S(   Ns   /etc/lilo.confs.   restoring the backup file %s to /etc/lilo.conf(   s
   up2dateLogs   initLogs   logs   TESTs   shutils   copys
   backupnames   rets   log_mes   LiloConfRestoreErrors   oss   remove(   s
   backupnames   rets   logs   shutil(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   restoreLiloConfig   s    	c         C   s7   d  k  } t i |   t i   } | i d |   d  S(   Ns   Deleteing the backupfile %s(   s   shutils   oss   removes
   backupfiles
   up2dateLogs   initLogs   logs   log_me(   s
   backupfiles   shutils   log(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   deleteLiloConfigBackup§   s    	c         C   s   t  i   } yC t i |  d d d d |  g d t d t } | i d |   Wn- t	 j
 o } t d   n t  n X| Sd  S(	   Ns
   /sbin/lilos   lilos   -ts   -rs   stdouts   stderrs0   Running " /sbin/lilo -t -r %s"  (lilo test mode)s(   unable to run lilo. Not running as root?(   s
   up2dateLogs   initLogs   logs   iutils   execWithRedirects   instRoots   Nones   rets   log_mes   RuntimeErrors   commands   LiloInstallError(   s   instRoots   logs   rets   command(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   runLiloTest­   s    
c         C   s   t  i   } t o d GHd Snk y: t i |  d d d |  g d t } | i	 d |   Wn- t
 j
 o } t d   n t  n X| Sd  S(	   NsΒ   
        iutil.execWithRedirect(instRoot + '/sbin/lilo' ,
                               [ "lilo", "-r", instRoot ],
                               stdout = None)
                               i    s
   /sbin/lilos   lilos   -rs   stdouts   Running " /sbin/lilo -r %s " s(   unable to run lilo. Not running as root?(   s
   up2dateLogs   initLogs   logs   TESTs   iutils   execWithRedirects   instRoots   Nones   rets   log_mes   RuntimeErrors   commands   LiloInstallError(   s   instRoots   logs   rets   command(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   runLiloΊ   s    
c         C   sj   |  d } d } t |  d j o |  d  d } n x* | | j o | d | } | d } q8 W| Sd  S(   Ns   .baki   i   i
   s   %s(   s	   labelNames   backups   counts   lens	   imagelist(   s	   labelNames	   imagelists   counts   backup(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys
   backupNameΠ   s    
 c   
      C   sϊ   t  } y |  i d  } Wn t  } n Xt  }	 | o |  i |  \ } } } } n d } | o | o
 d } n | o: xR | D]+ } | d }	 |  i |	  \ } } } } q Wn |  i |  \ } } } } |	 o
 |	 } n | | | | | | f Sd  S(   Ns   defaulti   i    (   s   Nones   defaultIsOthers   configs   getEntrys   defaults   tmp_defaults   getImages	   imagetypes   default_images
   image_paths   others	   imagelists   image(
   s   configs	   imagelists
   image_paths   defaults   images   defaultIsOthers   others   default_images	   imagetypes   tmp_default(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   findDefaultα   s(    

 
#
c         C   sM   t  i |  d  } t | d  d j o d } | Sn | d d  } | Sd  S(   Ns   kerneli   i    s   -upi
   (   s   strings   splits	   imageTypes   ress   lens   tmp(   s	   imageTypes   ress   tmp(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   genImageLabelType  s    c         C   s!  t  i   } t i   } | a d } | o
 d } n t
 i | t
 i  o t Sn | i |  t | i  o t d d | i   n | i   } t | |  \ } } } } } } x' |  D] \ } }	 t | | | |  qΑ W| d t t  i     } x% t
 i | t
 i"  o | d } qWy t# | |  Wn( t$ j
 o }
 t& |  t$ |
  n Xt o	 | GHn y t' d  } Wn d } n X| o t o t& |  t$ d	   n y t) d  } Wn t& |  t* d
   n X| o t& |  t* d   n | i+ d  d Sd  S(   Ns   linuxs   /etc/lilo.confs   
s   %ss	   .up2date-s   _s   /i   s   test install of lilo faileds   unable to run lilos)   unable to restore the backup copy of lilos   lilo updated succesfullyi    (,   s
   up2dateLogs   initLogs   logs   lilos   LiloConfigFiles   configs   tests   TESTs   labels   filenames   oss   accesss   R_OKs   Nones   reads   lens   unsupporteds   LiloConfParseErrors
   listImagess   liloimagelists   findDefaults   defaults   tmptypes   default_images
   image_paths   others   defaultIsOthers	   imageLists   removingImages	   imageTypes   removeImages   reprs   times
   backupfiles   F_OKs   installLiloConfigs   LiloConfErrors   infos   restoreLiloConfigs   runLiloTests   rets   runLilos   LiloInstallErrors   log_me(   s	   imageLists   tests   filenames   tmptypes   defaultIsOthers   labels   rets   others   configs	   imageTypes   infos
   image_paths
   backupfiles   logs   liloimagelists   removingImages   defaults   default_image(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   removeImages  sZ     
!  
	



c         C   sΥ  t  i   } t i   } | a d }
 | o
 d } n t
 i | t
 i  o t Sn | i |  t | i  o t d d | i   n | i   }	 t | |	  \ } } } } } } t } t i   } t i  | |  } | o | d } n t } | i" d  } x|  D]\ } } t' | d  \ } } | o
 | | j o d t* |  }
 n d }
 t o) d | GHd	 |
 GHd
 | GHd | GHHn | o
 t } n |
 |	 j oU | i+ |
  \ } } } } t/ |
 |	  } | i1 d |  | i2 d |
 | f  n t3 | | |
 | |  | o2 | o! | | j o
 d } qMd } qhd } n | o
 d } n d } | o
 t } n | o | i1 d |
  qqW| d t5 t6 i6    } x% t
 i | t
 i8  o | d } q΅Wy t9 | |  Wn( t: j
 o } t< |  t: |  n Xt o	 | GHn y t= d  } Wn d } n X| o t o t< |  t: d   n y t? d  } Wn t< |  t@ d   n X| o t< |  t@ d   n | i2 d  d Sd  S(   Ns   linuxs   /etc/lilo.confs   
s   %ss   names   roots   /s   newimage: %ss	   label: %ss   defaultType: %ss   imageType: %ss   labels)   renaming the lilo.conf entry for %s to %si   i    s   defaults	   .up2date-s   _s   test install of lilo faileds   unable to run lilos)   unable to restore the backup copy of lilos   lilo updated succesfully(A   s
   up2dateLogs   initLogs   logs   lilos   LiloConfigFiles   configs   tests   TESTs   labels   filenames   oss   accesss   R_OKs   Nones   reads   lens   unsupporteds   LiloConfParseErrors
   listImagess	   imagelists   findDefaults   defaults   tmptypes   default_images
   image_paths   others   defaultIsOthers   defaultTypes   transactions   initReadOnlyTransactions   tss   rpmUtilss   findDepLocals   headers   getEntrys   rootDevs	   imageLists   newimages	   imageTypes
   makeInitrds   initrds   initrdExistss   genImageLabelTypes   getImages   tmpTypes	   old_images   tmp_paths
   backupNames   new_old_labels   addEntrys   log_mes   addImages
   setdefaults   reprs   times
   backupfiles   F_OKs   installLiloConfigs   LiloConfErrors   infos   restoreLiloConfigs   runLiloTests   rets   runLilos   LiloInstallError(   s	   imageLists   tests   filenames
   setdefaults   initrdExistss   tmptypes   defaultIsOthers   rootDevs   rets	   imagelists   labels   tmpTypes   tss   new_old_labels   others   tmp_paths   configs	   imageTypes
   image_paths	   old_images
   backupfiles   newimages   defaultTypes   logs   infos   headers   defaults   initrds   default_image(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   installNewImagesd  s€     
! 				





 
	



s   __main__i   s   a:d:s   add=s   del=s   file=s   defaults(   Error parsing command line arguments: %ss   -as   --adds   -ds   --dels   --files   2.4.2-0.1.49BOOTs   kernel-BOOTs   2.4.2-0.1.49enterprises   kernel-enterprises   2.4.2-0.1.49smps
   kernel-smps   2.4.2-0.1.49s   kernels   2.4.7-2s   2.4.6-3.1BOOTs   2.4.9-13s   2.4.9-13smps   2.4.9-21s   filename: %ss   filenames   test(=   s   __doc__s   oss   syss   lilos   iutils   rhpl.translates   _s   N_s   times   strings   rpmUtilss   transactions   list_of_directivess   default_directivess   other_directivess   ignore_directivess   TESTs
   up2dateLogs   bootloadercfgs   Errors
   makeInitrds   LiloConfErrors   LiloConfRestoreErrors   LiloInstallErrors   LiloConfReadErrors   LiloConfParseErrors   removeImages   addImages   installLiloConfigs   restoreLiloConfigs   deleteLiloConfigBackups   runLiloTests   runLilos
   backupNames   findDefaults   genImageLabelTypes   Nones   removeImagess   installNewImagess   __name__s   getopts   lilocfgs   filenames   argvs   arglists   optlists   argss   errors   es   exits   addimages   delimages   opts   newimages   kernel_lists   kernel_list2s   kernel_list3s   kernel_list4s   kernel_list5s   kernel_list6s   kernel_list7(4   s   LiloConfParseErrors   Errors   removeImages   addImages   arglists   ignore_directivess   LiloConfReadErrors   newimages   LiloInstallErrors   kernel_list6s   delimages   kernel_list4s   installNewImagess   kernel_list2s
   up2dateLogs   lilos   filenames   LiloConfErrors   addimages   getopts   genImageLabelTypes   N_s   deleteLiloConfigBackups   opts   argss   strings   kernel_list7s   LiloConfRestoreErrors   lilocfgs   syss   kernel_list5s   kernel_lists   runLiloTests   other_directivess
   makeInitrds   restoreLiloConfigs   default_directivess   _s   kernel_list3s   optlists   transactions   es
   backupNames   list_of_directivess   iutils   installLiloConfigs   runLilos   times   rpmUtilss   oss   removeImagess   findDefault(    (    s(   /usr/share/rhn/up2date_client/lilocfg.pys   ?   s   							 			(							#	
V						 ""
**	