+
    �w±io?  ã                   óh   € ^ RI t ^ RIt^ RIt^ RIHtHtHt ^ RIHtH	t	 ^ RI
t
^ RIt ! R R]4      tR# )é    N)ÚOptionalÚTupleÚList)ÚPopenÚPIPEc                   óî   a € ] tR t^!t o RV 3R lR lltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR ltV 3R lR lt	V 3R lR lt
V 3R lR ltV 3R lR ltV 3R lR ltRV 3R lR lltRtV tR# )ÚKernelDetectionNc                óH   <€ V ^8„  d   QhRS[ S[P                  ,          RR/# )é   ÚcacheÚreturnN)r   Úapt_pkgÚCache)ÚformatÚ__classdict__s   "€Ú?/usr/lib/python3/dist-packages/UbuntuDrivers/kerneldetection.pyÚ__annotate__ÚKernelDetection.__annotate__#   s(   ø€ ÷ Añ A™h¡w§}¡}Õ5ð AÀñ Aó    c                ó0  € V'       d$   Wn         \        P                  ! V4      V n        R # \        P                  ! 4        \        P
                  ! 4        \        P                  ! R 4      V n         \        P                  ! V P                   4      V n        R # ©N)Ú	apt_cacher   ÚDepCacheÚapt_depcacheÚinit_configÚinit_systemr   )Úselfr   s   &&r   Ú__init__ÚKernelDetection.__init__#   s\   € ßØ"ŒNÜ '× 0Ò 0°Ó 7ˆDÖä×ÒÔ!Ü×ÒÔ!Ü$Ÿ]š]¨4Ó0ˆDŒNÜ '× 0Ò 0°·±Ó @ˆDÖr   c                ó,   <€ V ^8„  d   QhRS[ RS[ RS[/# )r   Úterm1Úterm2r   )ÚstrÚbool)r   r   s   "€r   r   r   -   s"   ø€ ÷ &ñ &¡cð &±#ð &¹$ñ &r   c                óô  € \         P                  ! R 4      pVP                  V4      pVP                  V4      pV'       dW   V'       dO   VP                  ^4      : RVP                  ^4      : 2pVP                  ^4      : RVP                  ^4      : 2p\        P
                  ! RV: RV: 24       RV: RV: 2p\        VP                  R4      4      pVP                  4        VP                  '       * # )z(.+)-([0-9]+)-(.+)Ú-z
Comparing z with zdpkg --compare-versions z gt Ú )
ÚreÚcompileÚmatchÚgroupÚloggingÚdebugr   ÚsplitÚcommunicateÚ
returncode)r   r!   r"   ÚpatternÚmatch1Úmatch2ÚcommandÚprocesss   &&&     r   Ú_is_greater_thanÚ KernelDetection._is_greater_than-   s±   € ô —*’*Ð1Ó2ˆØ—‘˜uÓ%ˆØ—‘˜uÓ%ˆß—fØ%Ÿ|™|¨Až°·±¸QµÐ@ˆEØ%Ÿ|™|¨Až°·±¸QµÐ@ˆEä�‹³²uÐ=Õ>Û8=ºuÐEˆÜ˜Ÿ™ cÓ*Ó+ˆØ×ÑÔØ×%Ñ%Ô%Ð%r   c                ó<   <€ V ^8„  d   QhRS[ S[,          RS[RS[/# )r   Ú
candidatesÚimager   )r   r#   )r   r   s   "€r   r   r   =   s&   ø€ ÷ ñ ©T±#­Yð ¹sð Ásñ r   c                óŠ   € \         P                  ! R 4      pVP                  V4      pRpV'       d   VP                  ^4      pV# )z2linux-image-([0-9]+\.[0-9]+\.[0-9]+)-([0-9]+)-(.+)Ú )r(   r)   r*   r+   )r   r9   r:   r1   r*   Úflavours   &&&   r   Ú_get_linux_flavourÚ"KernelDetection._get_linux_flavour=   s9   € Ü—*’*ÐRÓSˆØ—‘˜eÓ$ˆØˆßØ—k‘k !“nˆGàˆr   c                óJ   <€ V ^8„  d   QhRS[ P                  RS[S[,          /# )r   Úpkgr   )r   ÚPackager   r#   )r   r   s   "€r   r   r   F   s#   ø€ ÷ 	ñ 	¡§¡ð 	±X¹cµ]ñ 	r   c                óÄ   € VP                   pVP                  R 4      '       d=   RV9  d6   VP                  '       g"   V P                  P	                  V4      '       d   V# R# )úlinux-imageÚextraN)ÚnameÚ
startswithÚcurrent_verr   Úmarked_install)r   rA   Úpackage_names   && r   Ú_filter_cacheÚKernelDetection._filter_cacheF   sL   € Ø—x‘xˆà×#Ñ# M×2Ò2Ø˜|Ô+Ø——� D×$5Ñ$5×$DÑ$DÀS×$IÒ$IàÐár   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# )r   Útargetr   ©r#   )r   r   s   "€r   r   r   Q   s   ø€ ÷ Qñ Q©Sð Q±Sñ Qr   c                ó
  € RpRpRpRVR8X  d   RMR,          p\         P                  ! R4      p\        V P                  V P                  P
                  4       F}  pV'       g   K  VP                  V4      pV'       g   K(  VP                  ^ 4      p	VP                  ^4      : RVP                  ^4      : 2p
V P                  W¤4      '       g   Ky  T
pT	pK  	  V'       Ed   VR8X  d   VP                  RR4      pMTpV P                  V,          P                   Uu. uFF  pVP                  P                  P                  V4      '       g   K0  VP                  P                  NKH  	  ppV'       Edr   RpV Fš  p V P                  V,          pVP                  V4      '       dm   V'       dc   VP                  '       g"   V P                  P!                  V4      '       d.   VP                  VR4      VP                  VR4      8”  d   TpK”  K–  K˜  Kš  Kœ  	  VR8X  dÉ   V P                  V,          P                   Uu. uFF  pVP                  P                  P                  R4      '       g   K0  VP                  P                  NKH  	  ppV'       dT   V P%                  WÛ4      pRpV F%  pVP                  R	V,          4      '       g   K#  Tp M	  V'       g   V^ ,          pV# TpV# u upi   \"         d     EKƒ  i ; iu upi )
z7Get the linux headers, linux-image or linux metapackager<   zlinux-%sÚheadersr:   z,linux-image-(?:unsigned-)?(.+)-([0-9]+)-(.+)r&   Úmetazlinux-z	linux-%s-)r(   r)   ÚmaprK   r   Úpackagesr*   r+   r6   ÚreplaceÚrev_depends_listÚ
parent_pkgrF   rG   rH   r   rI   ÚKeyErrorr>   )r   rN   ÚmetapackageÚimage_packageÚversionÚprefixr1   rJ   r*   Úcurrent_packageÚcurrent_versionÚtarget_packageÚdepÚreverse_dependenciesÚ	candidateÚcandidate_pkgr=   Ú
linux_metarR   s   &&                 r   Ú_get_linux_metapackageÚ&KernelDetection._get_linux_metapackageQ   sº  € àˆØˆØˆØ¨F°iÔ,?™yÀWÕMˆä—*’*ÐKÓLˆä × 2Ñ 2°D·N±N×4KÑ4KÖLˆLß‰|ØŸ™ lÓ3�÷ ‘5Ø&+§k¡k°!£n�OØ16·±¸Q¶ÀÇÁÈQÅÐ&P�Oð ×,Ñ,¨_×FÔFØ"1˜Ø(7šñ M÷ ˆ7Ø˜Ô"Ø!.×!6Ñ!6°wÀ	Ó!J‘à!.�ð  Ÿ>™>¨.Õ9×JÒJó$áJ�CØ—>‘>×&Ñ&×1Ñ1°&×9ô $�—‘×#Ô#ÙJð !ð $÷ $Ð#ð !�Û!5�Ið!Ø(,¯©°yÕ(A˜à%×0Ñ0°×8Ò8ç -à$1×$=×$=Ð$=Ø'+×'8Ñ'8×'GÑ'GÈ×'VÒ'Vð !*× 1Ñ 1°&¸"Ó =Ø)×1Ñ1°&¸"Ó=ô!>ð +4šKñ!>ñ (Wñ !.ñ 9ñ	 "6ð& ˜VÔ#ð $(§>¡>°+Õ#>×#OÒ#Oó,á#O˜CØŸ>™>×.Ñ.×9Ñ9¸(×Cô ,˜Ÿ™×+Ô+Ù#Oð )ð ,÷
 ,Ø"&×"9Ñ"9Ø0ó#˜ð &(˜
Û$8˜Dà#Ÿ™¨{¸gÕ/F×GÔGØ-1 
Ù %ñ	 %9÷  *à*>¸qÕ*A˜Kð Ðð +5˜KØÐùòi$øô4 $ô !Û ð!üò
,s<   Ä-K(ÅK(Å=1K-Æ/K-Ç K-Ç")K-È=-L É/L Ë-K=Ë<K=c                ó    <€ V ^8„  d   QhRS[ /# ©r   r   rO   )r   r   s   "€r   r   r   ¤   s   ø€ ÷ 6ñ 6©sñ 6r   c                ó$   € V P                  R4      # )ú5Get the linux headers for the newest_kernel installedrQ   ©re   ©r   s   &r   Úget_linux_headers_metapackageÚ-KernelDetection.get_linux_headers_metapackage¤   s   € à×*Ñ*¨9Ó5Ð5r   c                ó    <€ V ^8„  d   QhRS[ /# rh   rO   )r   r   s   "€r   r   r   ¨   s   ø€ ÷ 4ñ 4©Sñ 4r   c                ó$   € V P                  R4      # )rj   r:   rk   rl   s   &r   Úget_linux_image_metapackageÚ+KernelDetection.get_linux_image_metapackage¨   s   € à×*Ñ*¨7Ó3Ð3r   c                ó    <€ V ^8„  d   QhRS[ /# rh   rO   )r   r   s   "€r   r   r   ¬   s   ø€ ÷ 3ñ 3¡sñ 3r   c                ó$   € V P                  R4      # )z9Get the linux metapackage for the newest_kernel installedrR   rk   rl   s   &r   Úget_linux_metapackageÚ%KernelDetection.get_linux_metapackage¬   s   € à×*Ñ*¨6Ó2Ð2r   c                ó0   <€ V ^8„  d   QhRS[ S[,          /# rh   )r   r#   )r   r   s   "€r   r   r   °   s   ø€ ÷ ñ ¡8©C¥=ñ r   c                óÂ  € V P                  4       pR p V P                  P                  V P                  V,          4      pV'       di   VP                  P                  R4       FI  pV F@  w  rVpVP                  R4      '       g   K  VP                  4       P                  RR4      p KG  	  KK  	  V#   \         d"    \        P                  ! RT,          4        R # i ; i)NÚDependsrD   úlinux-image-r<   z#No dependencies can be found for %s)rq   r   Úget_candidate_verr   Údepends_list_strÚgetrG   ÚstriprU   rX   r,   Úerror)r   Úlinux_image_metaÚlinux_versionrb   Údep_listÚdep_nameÚdep_verÚdep_ops   &       r   Úget_linux_versionÚ!KernelDetection.get_linux_version°   sÍ   € Ø×;Ñ;Ó=ÐØˆð	ð ×)Ñ)×;Ñ;Ø—‘Ð/Õ0óˆI÷ Ø )× :Ñ :× >Ñ >¸yÖ I�HÛ5=Ñ1˜¨6Ø#×.Ñ.¨}×=Ô=Ø,4¯N©NÓ,<×,DÑ,DÀ^ÐUWÓ,X˜MÚ!ó 6>ñ !Jð$ Ðøô ô 	Ü�MŠMÐ?ÐCSÕTÔUÚð	ús   ”3B2 Á:B2 Â)B2 Â2(CÃCc                óN   <€ V ^8„  d   QhRS[ S[S[S[S[,          S[3,          /# rh   )r   r$   r#   r   )r   r   s   "€r   r   r   Î   s)   ø€ ÷ M3ñ M3©E±$¹¹XÁc½]ÉDÐ2PÕ,Qñ M3r   c                óØ  € \         P                  ! R4       \        P                  ! 4       P                  p\         P                  ! RV4       \
        P                  ! RV4      '       g   \         P                  ! R4       RVRR3# . pV P                  P                   F•  pVP                  '       g   K  VP                  P                  R4      '       g   K:  \
        P                  ! R	VP                  4      '       d   Kc  VP                  V4       \         P                  ! R
VP                  4       K—  	  V EF’  p\         P                  ! RVP                  4       V P                  P                  V4      pV'       g$   \         P                  ! RVP                  4       Kk  V P                  P                  V4      '       g$   \         P                  ! RVP                  4       K¯  VP                   P#                  R. 4       FÃ  pV Fº  pVP$                  P                  P                  R4      '       g   K0  \
        P                  ! RVP$                  P                  4      '       g   Kc  VP$                  P                  P'                  R4      ^,          p\         P                  ! RVVP                  4       RWR3u u u # 	  KÅ  	  EK•  	  \         P                  ! R4       RVRR3# )aV  Check if running kernel is outdated.

Returns a tuple (is_outdated, running_version, latest_version, requires_dkms):
    is_outdated: True if the kernel is outdated
    running_version: version string of the running kernel
    latest_version: version string of the latest available kernel
    requires_dkms: True if DKMS modules are required
z&Checking if running kernel is outdatedzRunning kernel version: %sz\d+\.\d+\.\d+-\d+zERunning kernel version does not match expected format - DKMS requiredFNTrz   z=linux-image-(\d+\.\d+\.\d+-\d+|\w*unsigned-\d+\.\d+\.\d+-\d+)z&Found installed kernel metapackage: %sz#Checking metapackage %s for updateszNo candidate version for %szNo update available for %sry   zlinux-image-\d+\.\d+\.\d+-\d+z#Found new kernel version %s from %szNo kernel updates found)r,   r-   ÚosÚunameÚreleaser(   r*   r   rT   rH   rF   rG   Úappendr   r{   Úis_upgradableÚdepends_listr}   Ú
target_pkgr.   )	r   Úrunning_versionÚ	meta_pkgsrA   Úmeta_pkgrb   r`   Údep_orÚlatest_versions	   &        r   Úis_running_kernel_outdatedÚ*KernelDetection.is_running_kernel_outdatedÎ   s>  € ô 	�ŠÐ>Ô?ô Ÿ(š(›*×,Ñ,ˆÜ�ŠÐ2°OÔDô
 �xŠxÐ,¨o×>Ò>Ü�MŠMØWôð ˜/¨4°Ð5Ð5ð ˆ	Ø—>‘>×*Ô*ˆCØ—?—?�?ÙØ—8‘8×&Ñ& ~×6Ò6Ùä�xŠxØPØ—‘÷ò ñ Ø×Ñ˜SÔ!Ü�MŠMÐBÀCÇHÁHÖMñ +ô "ˆHÜ�MŠMÐ?ÀÇÁÔOð ×)Ñ)×;Ñ;¸HÓEˆIßÜ—’Ð;¸X¿]¹]ÔKÙà×$Ñ$×2Ñ2°8×<Ò<Ü—’Ð:¸H¿M¹MÔJÙð !×-Ñ-×1Ñ1°)¸RÖ@�Û!�FØ!×,Ñ,×1Ñ1×<Ñ<¸^×LÒLÙ ÜŸ8š8Ø8¸&×:KÑ:K×:PÑ:P÷ò ñ !à%+×%6Ñ%6×%;Ñ%;×%AÑ%AÀ.Ó%QÐRSÕ%T�NÜ—M’MØ=Ø&Ø Ÿ™ôð   À%ÐGÖGó "ô Añ "ô@ 	�ŠÐ/Ô0Ø�o t¨UÐ2Ð2r   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# )r   Úinclude_dkmsr   )r$   )r   r   s   "€r   r   r     s   ø€ ÷ Lñ L±dð LÁtñ Lr   c                ób  € V P                  4       w  r#rEV'       Ed)   V'       Eg    \        RR.\        \        R7      pVP                  4       w  rxVP	                  R4      P                  4       p	VP	                  R4      P                  4       p
RV	9   g   RV	9   d%   \        RV,          \        P                  R7       R	# R
V	9   g   RV	9   d%   \        RV,          \        P                  R7       R	# RV
9   d%   \        RV,          \        P                  R7       R	#  \        RV,          \        P                  R7       R	# R# V'       d+   V'       d#   \        RV RV R2\        P                  R7       R#   \         d+   p\        P                  ! R\        T4      4        Rp?LŠRp?ii ; i)z–Print a warning message if the kernel needs updating.

Returns:
    should_exit: True if the caller should exit (e.g. DKMS required but not included)
Úmokutilz
--sb-state)ÚstdoutÚstderrzutf-8zsecureboot enabledzsecure boot enableduQ  Your running kernel (%s) requires DKMS modules, and you have Secure Boot enabled. To proceed, ensure you have access to your machineâ€™s UEFI menu and have the rights to enroll a Machine Owner Key (MOK), then re-run ubuntu-drivers with --include-dkms. This will install the DKMS modules, then prompt you to enroll the new MOK and reboot.)ÚfileTzsecureboot disabledzsecure boot disableda  Your running kernel (%s) requires DKMS modules. You have Secure Boot disabled, but if you enable it in the future, you will need to sign or reinstall these DKMS modules for them to work. If you would like to continue, please re-run ubuntu-drivers with --include-dkms.z'this system doesn't support secure bootzaYour running kernel (%s) requires DKMS modules. Please use --include-dkms if you want to proceed.z)Could not determine Secure Boot state: %sNa4  Your running kernel (%s) requires DKMS modules, and ubuntu-drivers was unable to determine if Secure Boot is enabled. If you have SB enabled, you will need to enroll a MOK to proceed, which will require access to your UEFI menu and administrative privileges. Please use --include-dkms if you want to proceed.FzWarning: Your running kernel (z) is outdated. A newer kernel (zn) is available in the Ubuntu archives. Please run 'sudo apt update && sudo apt upgrade' to update your system.)r–   r   r   r/   ÚdecodeÚlowerÚprintÚsysr�   Ú	Exceptionr,   Úwarningr#   )r   r™   Úis_outdatedÚrunningÚlatestÚrequires_dkmsr5   Úoutput_bytesÚ	err_bytesÚoutputÚerrÚes   &&          r   Úget_kernel_update_warningÚ)KernelDetection.get_kernel_update_warning  s­  € ð 7;×6UÑ6UÓ6WÑ3ˆ˜fçˆ=ß�<ð)YÜ# Y°Ð$=ÄdÔSWÔX�GØ.5×.AÑ.AÓ.CÑ+�LØ".×"5Ñ"5°gÓ">×"DÑ"DÓ"F�FØ(×/Ñ/°Ó8×>Ñ>Ó@�Cà,°Ô6Ø0°FÔ:äðPð
 &õ&ô "%§¡õñ  $à-°Ô7Ø1°VÔ;äðoð &õ	&ô
 "%§¡õñ  $ØBÀcÔIÜð+Ø-4õ5ä!$§¡õñ
  $ð Jô ð=ð @GõGô Ÿ™õñ ñ çŸ6ÜØ0°°	ð :#Ø#) (ð +Zð[ô —Z‘Zõ	ñ øô3 !ô YÜ—O’OÐ$OÔQTÐUVÓQW×XÑXûðYús$   §BE9 Ã0E9 Ã3)E9 Å9F.Æ F)Æ)F.)r   r   r   )F)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r6   r>   rK   re   rm   rq   ru   r†   r–   r®   Ú__static_attributes__Ú__classdictcell__)r   s   @r   r	   r	   !   sƒ   ø‡ € ÷Aò A÷&ð &÷ ð ÷	ð 	÷Qð Q÷f6ð 6÷4ð 4÷3ð 3÷ð ÷<M3ð M3÷^L÷ Lð Lr   r	   )r   r,   r(   Útypingr   r   r   Ú
subprocessr   r   rŠ   r¢   Úobjectr	   © r   r   Ú<module>rº      s-   ðó. Û Û 	ß (Ñ (ç "Û 	Û 
ôH�fö Hr   