Ñò ·µiVc@s‹dZddklZlZddklZddklZlZddk l Z l Z ddk l Z de fd„ƒYZd „Zd S( s8 ChainBootInstance autogenerator backend for pybootmgmt iÿÿÿÿ(tPopentCalledProcessError(t!BootmgmtUnsupportedOperationError(t BootConfigtChainDiskBootInstance(t LoggerMixintget_current_arch_string(tSystemFirmwaret"ChainDiskBootInstanceAutogeneratorcBseZdZd„ZRS(sÿAutogenerator implementation for ChainDiskBootInstance generation. This implementation invokes a helper script that scans the system's disks for OS instances that can be chainloaded, then outputs information in an easily-parseable format. cCs|itijotdƒ‚ntiƒ}|dj o |i}nd}tƒdjp |djo|i dƒgSy7dg}t i |dt i dt i ƒ}|i }Wn°tj o}|i d|ƒgStj o}|i d |iƒ|io'|ii o|i d |ii ƒn|io'|iio|i d |iiƒngSXg} d } xu|iƒD]g} | d 7} |i d| | fƒ| idƒp| iƒdjoqny| idƒ\} } }}t| ƒ} |iƒdjo?|idƒdjot|idƒƒ}qSt|ƒ}nd}|djotnt}Wn&tj o|i d| ƒqnX|djo | f}n | |f}tdd| d|d|ƒ}| i|ƒqW|i d| ƒ|i dt| ƒƒ| S(s"The workhorse of the autogenerators:Chain loader autogen not supported on non-disk BootConfigstx86tbioss;Chainloader entry autogeneration only supported on x86 BIOSs#/usr/lib/boot/bootmgmt-helper-chaintstdouttstderrs"Executing helper script failed: %ssHelper script returned %dsstdout was: %s sstderr was: %s iisOutput line %d: "%s"t#tt:t,iÿÿÿÿtTrues'Malformed output line from helper: "%s"ttitlet chaininfot forceactives#%d line(s) read from helper script.s %d boot instances autogenerated.N( t boot_classRtBOOT_CLASS_DISKRRtgettNonetfw_nameRt_debugRt check_calltSTORER tOSErrorRt returncodetpopenR t splitlinest startswithtstriptsplittinttfindttupleRtFalset ValueErrorRtappendtlen(tselft bootconfigtcur_fwt cur_fw_namet helper_cmdt script_outputt script_stdoutt error_exctcpet inst_listtlinenotlineRtdiskt partitiontactivet chain_infotbootinst((s.../../common/bootmgmt/backend/autogen/chain.pytautogen+sl         #     (t__name__t __module__t__doc__R<(((s.../../common/bootmgmt/backend/autogen/chain.pyR%scCstƒ}|i|ƒS(s2Main entry point used by the autogenerator factory(RR<(R,tcdbia((s.../../common/bootmgmt/backend/autogen/chain.pytautogenerate_boot_instancesys N(R?tsolaris_installRRtbootmgmtRtbootmgmt.bootconfigRRtbootmgmt.bootutilRRtbootmgmt.bootinfoRRRA(((s.../../common/bootmgmt/backend/autogen/chain.pytsT