+
     Gisc  c                   s    ^RI Ht ^RI5 ^ RIt^RI Ht ^ RIHt ^ RIH	t	 ^ RI
t
^ RIt^ RIt^ RIHt ]P                  P!                  4       t ! R R]P$                  4      tR# )	   )base)Z*N)
exceptions)commands)sleepc                   s  a a ] tR t^t oRtV 3R ltR tR t]R 4       t	R t
R tR t. . 3R	 ltR
 tR tR tR tR tR tR t]P,                  3R ltR tR tR tR tR tR tR tR tR t R t!R t"R t#R t$R t%]&! R 4      R! 4       t']&! R"4      R# 4       t(]&! R$4      R% 4       t)]&! R&R'^
R(7      R) 4       t*]&! R*R'^
R(7      R+ 4       t+]&! R,R'^
R(7      R- 4       t,]&! R.R'^
R(7      R/ 4       t-R0 t.R1t/Vt0V ;t1# )2BootloaderPlugina  
Adds options to the kernel command line. This plug-in supports the
GRUB 2 boot loader and the Boot Loader Specification (BLS).

NOTE: *TuneD* will not remove or replace kernel command line
parameters added via other methods like *grubby*. *TuneD* will manage
the kernel command line parameters added via *TuneD*. Please refer
to your platform bootloader documentation about how to identify and
manage kernel command line parameters set outside of *TuneD*.

Customized non-standard location of the GRUB 2 configuration file
can be specified by the [option]`grub2_cfg_file` option.

The kernel options are added to the current GRUB configuration and
its templates. Reboot the system for the kernel option to take effect.

Switching to another profile or manually stopping the `tuned`
service removes the additional options. If you shut down or reboot
the system, the kernel options persist in the [filename]`grub.cfg`
file and grub environment files.

The kernel options can be specified by the following syntax:

[subs="quotes"]
----
cmdline__suffix__=__arg1__ __arg2__ ... __argN__
----

Or with an alternative, but equivalent syntax:

[subs="quotes"]
----
cmdline__suffix__=+__arg1__ __arg2__ ... __argN__
----

Where __suffix__ can be arbitrary (even empty) alphanumeric
string which should be unique across all loaded profiles. It is
recommended to use the profile name as the __suffix__
(for example, [option]`cmdline_my_profile`). If there are multiple
[option]`cmdline` options with the same suffix, during the profile
load/merge the value which was assigned previously will be used. This
is the same behavior as any other plug-in options. The final kernel
command line is constructed by concatenating all the resulting
[option]`cmdline` options.

It is also possible to remove kernel options by the following syntax:

[subs="quotes"]
----
cmdline__suffix__=-__arg1__ __arg2__ ... __argN__
----

Such kernel options will not be concatenated and thus removed during
the final kernel command line construction.

.Modifying the kernel command line
====
For example, to add the [option]`quiet` kernel option to a *TuneD*
profile, include the following lines in the [filename]`tuned.conf`
file:
----
[bootloader]
cmdline_my_profile=+quiet
----
An example of a custom profile `my_profile` that adds the
[option]`isolcpus=2` option to the kernel command line:
----
[bootloader]
cmdline_my_profile=isolcpus=2
----
An example of a custom profile `my_profile` that removes the
[option]`rhgb quiet` options from the kernel command line (if
previously added by *TuneD*):
----
[bootloader]
cmdline_my_profile=-rhgb quiet
----
====

.Modifying the kernel command line, example with inheritance
====
For example, to add the [option]`rhgb quiet` kernel options to a
*TuneD* profile `profile_1`:
----
[bootloader]
cmdline_profile_1=+rhgb quiet
----
In the child profile `profile_2` drop the [option]`quiet` option
from the kernel command line:
----
[main]
include=profile_1

[bootloader]
cmdline_profile_2=-quiet
----
The final kernel command line will be [option]`rhgb`. In case the same
[option]`cmdline` suffix as in the `profile_1` is used:
----
[main]
include=profile_1

[bootloader]
cmdline_profile_1=-quiet
----
It will result in the empty kernel command line because the merge
executes and the [option]`cmdline_profile_1` gets redefined to just
[option]`-quiet`. Thus there is nothing to remove in the final kernel
command line processing.
====

The [option]`initrd_add_img=IMAGE` adds an initrd overlay file
`IMAGE`. If the `IMAGE` file name begins with '/', the absolute path is
used. Otherwise, the current profile directory is used as the base
directory for the `IMAGE`.

The [option]`initrd_add_dir=DIR` creates an initrd image from the
directory `DIR` and adds the resulting image as an overlay.
If the `DIR` directory name begins with '/', the absolute path
is used. Otherwise, the current profile directory is used as the
base directory for the `DIR`.

The [option]`initrd_dst_img=PATHNAME` sets the name and location of
the resulting initrd image. Typically, it is not necessary to use this
option. By default, the location of initrd images is `/boot` and the
name of the image is taken as the basename of `IMAGE` or `DIR`. This can
be overridden by setting [option]`initrd_dst_img`.

The [option]`initrd_remove_dir=VALUE` removes the source directory
from which the initrd image was built if `VALUE` is true. Only 'y',
'yes', 't', 'true' and '1' (case insensitive) are accepted as true
values for this option. Other values are interpreted as false.

.Adding an overlay initrd image
====
----
[bootloader]
initrd_remove_dir=True
initrd_add_dir=/tmp/tuned-initrd.img
----
This creates an initrd image from the `/tmp/tuned-initrd.img` directory
and and then removes the `tuned-initrd.img` directory from `/tmp`.
====

The [option]`skip_grub_config=VALUE` does not change grub
configuration if `VALUE` is true. However, [option]`cmdline`
options are still processed, and the result is used to verify the current
cmdline. Only 'y', 'yes', 't', 'true' and '1' (case insensitive) are accepted
as true values for this option. Other values are interpreted as false.

.Do not change grub configuration
====
----
[bootloader]
skip_grub_config=True
cmdline=+systemd.cpu_affinity=1
----
====
c                s   < \         P                  P                  \        P                  4      '       g   \
        P                  ! R 4      h\        \        V `&  ! V/ VB  \        4       V n        R# )z4Required GRUB2 template not found, disabling plugin.N)ospathZisfileconstsZGRUB2_TUNED_TEMPLATE_PATHr   ZNotSupportedPluginExceptionZsuperr   __init__r   _cmd)selfZargsZkwargs	__class__s   &*,D/usr/lib/python3.14/site-packages/tuned/plugins/plugin_bootloader.pyr	   ZBootloaderPlugin.__init__   sL    	88	9	9		/	/0f	gg$($9&9j$)    c                s    R Vn         RVn        R V n        R V n        R V n        RV n        RV n        RV n        V P                  4       V n	        V P                  4       V n        V P                  4       RJV n        R# )FTN )Z_has_dynamic_tuningZ_has_static_tuningupdate_grub2_cfg_skip_grub_config_val_initrd_remove_dir_initrd_dst_img_val_cmdline_val_initrd_val_get_grub2_cfg_files_grub2_cfg_file_names_bls_enabled_bls_rpm_ostree_status_rpm_ostreer   instance   &&r   _instance_initZBootloaderPlugin._instance_init   sy    !&( $($$$!$!$$$#88:$!$),,.d:$r   c                s    R # N r   r   r   _instance_cleanupZ"BootloaderPlugin._instance_cleanup   s    r   c                s"    R RRRRRRRRRRRRR/# )grub2_cfg_fileNinitrd_dst_imginitrd_add_imginitrd_add_dirinitrd_remove_dircmdlineskip_grub_configr!   )Zcls   &r   _get_config_optionsZ$BootloaderPlugin._get_config_options   s1     TTTTdt
 r   c                s<   V P                   P                  RR.RR7      w  rp\        P                  RV: RV: 24       V^ 8w  d   R# VP	                  4       p\        V4      ^8  g   V^ ,          R8w  d   \        P                  R	V,          4       R# V^,          # )
zS
Returns status of rpm-ostree transactions or None if not run on rpm-ostree system

rpm-ostreeZstatusTZ
return_errz!rpm-ostree status output stdout:
z	
stderr:
NzState:z2Exceptional format of rpm-ostree status result:
%s)r
   executelogdebugsplitlenwarning)r   rcouterrZsplited   &    r   r   Z#BootloaderPlugin._rpm_ostree_status   s     99$$lH%=$$O.2C))3LM1W
IIK'\Ax/;;DsJK
	r   c                s    ^
pRp\        V4       F&  pV P                  4       R8X  d    R# \        V4       K(  	  V P                  4       R8H  # )z:Check that rpm-ostree is idle, allowing some waiting time.g      ?ZidleT)Zranger   r   )r   Zsleep_cyclesZ
sleep_secs_   &   r   _wait_till_rpm_ostree_idleZ+BootloaderPlugin._wait_till_rpm_ostree_idle   sM    ,*a
6)  
	 	 	"f	,,r   c                s6   V P                  4       '       g   \        P                  R4       R# V P                  P	                  RR.RR7      w  rpV'       d   \        P                  RV,          4       V^ 8w  d   \        P                  RV,          4       R# V# )	zPRetrieve the output of rpm-ostree kargs, i.e., current default kernel arguments.z2Error getting rpm-ostree kargs: rpm-ostree is busyNr,   kargsTr-   zrpm-ostree kargs: %sz"Error getting rpm-ostree kargs: %s)r:   r/   errorr
   r.   r0   )r   r4   r5   r6   r9   r   _get_rpm_ostree_kargsZ&BootloaderPlugin._get_rpm_ostree_kargs   sy    		(	(	*	*99AB
99$$lG%<$N.2C99#c)*1W991C78
	*r   c                sz   V P                  4       '       g   \        P                  R4       R# V P                  P	                  RR.V Uu. uF  pRV,          NK  	  up,           V Uu. uF  pRV,          NK  	  up,           RR7      w  rEpV^ 8w  d   \        P                  R	V,          4       R# R# u upi u upi )
z
Modify (delete and append) kernel arguments in a rpm-ostree system.
Return a boolean indicating whether the operation was successful.
z4Error modifying rpm-ostree kargs: rpm-ostree is busyFr,   r;   z--delete=%sz--append=%sTr-   z$Error modifying rpm-ostree kargs: %s)r:   r/   r<   r
   r.   )r   delete_kargsappend_kargskargr4   r8   r6      &&&    r   _modify_rpm_ostree_kargsZ)BootloaderPlugin._modify_rpm_ostree_kargs   s    
 
	(	(	*	*99CD
""'%12\TMD\23%12\TMD\23?C # E,2# 1W993c9:
	 32s   
B3
(B8
c                sX   V P                  4       P                  4       p. pV Fz  p\        V4      P                  R4      '       d   VP	                  V4       K6  WB9   d   W,          W$&   KH  \
        P                  RV: RV P                  P                  : R24       K|  	  RpV F  pW,          pVe   VR8X  d   K  V^ ,          pVR,          pVR,          P                  4       p	VR8X  g   VR	8X  d#   VR9   d   V	R8w  d   VRV	,           ,          pKo  Kq  VR
8X  d_   V	R8w  dV   V	P                  4        F?  p
\        P                  ! V
4      p\        P                  ! RV,           R,           RV4      pKA  	  K  K  VRV,           ,          pK  	  VP                  4       pVR8w  d   WRR&   V# )zSMerge provided options with plugin default options and merge all cmdline.* options.r(   zUnknown option 'z' for plugin 'z'.r   :r    i   N:r    NN+\- z(\A|\s)z	(?=\Z|\s))rD   rC   rE   )r+   copystrZ
startswithappendr/   r3   r   __name__Zstripr1   reescapesub)r   ZoptionsZ	effectiveZcmdline_keysZkeyr(   ZvalZopZop1ZvalsZpZregexs   &&          r   _get_effective_optionsZ'BootloaderPlugin._get_effective_options
  si   &&(--/),c	#h)$$\INKK#t~~?V?VWX  'c	3	kSBYA2	S3
b'--/4CiB$J3*:#:rzd
W 
c	rzjjliilezE)L8#wGg  
 sSyG! " MMO']!Y	r   c                s    . p\         P                   F;  p\        P                  P	                  V4      '       g   K*  VP                  V4       K=  	  V# r    )r   ZGRUB2_CFG_FILESr   r   existsrI   )r   Z	cfg_filesf   &  r   r   Z%BootloaderPlugin._get_grub2_cfg_files,  s@    )!!aggnnQQ " 
r   c                s"   V P                   P                  \        P                  R R7      p\	        V4      ^ 8:  d-   \
        P                  R\        P                  ,          4       R# \        P                  ! RV\        P                  R7      RJ# )TZno_errorcannot read '%s'Fz=^\s*GRUB_ENABLE_BLSCFG\s*=\s*\"?\s*[tT][rR][uU][eE]\s*\"?\s*$ZflagsN)
r
   	read_filer   GRUB2_DEFAULT_ENV_FILEr2   r/   inforK   search	MULTILINE)r   grub2_default_env   & r   r   ZBootloaderPlugin._bls_enabled3  sr    ii))&*G*GTX)Y	q 88!>!>>?
	SUf<<
 $
% %r   c                sV    V P                   P                  \        P                  V4      # r    )r
   add_modify_option_in_filer   BOOT_CMDLINE_FILE)r   dr   r   _patch_bootcmdlineZ#BootloaderPlugin._patch_bootcmdline<  s    		,	,V-E-Eq	IIr   c                s.   V P                  \        P                  R \        P                  R /4       V P                  '       g   \
        P                  R4       R# V P                   FO  pV P                  P                  VR\        P                  ,           R R\        P                  ,           R /RR7       KQ  	  V P                  eN   \
        P                  RV P                  ,          4       V P                  P                  V P                  4       R# R# )r   cannot find grub.cfg to patchNzset\s+F)addzremoving initrd image '%s')r_   r   BOOT_CMDLINE_TUNED_VARBOOT_CMDLINE_INITRD_ADD_VARr   r/   rW   r
   r\   GRUB2_TUNED_VARGRUB2_TUNED_INITRD_VARr   unlink)r   rP   r[   r   _remove_grub2_tuningZ%BootloaderPlugin._remove_grub2_tuning?  s    6882v?a?adfgh		#	#	#88+,	%%a99&&q9v7M7M+MPRT]`f`}`}T}  AC  +D  LQ&  R &	)88(4+C+CCD99D,,- *r   c                s   V P                   P                  \        P                  4      p\        P
                  ! \        P                  R,           V\        P                  R7      pV'       d   V^,          P                  4       # . # )z`Return the list of kernel arguments that were appended by this profile (in a rpm-ostree system).z	=\"(.*)\"rT   )	r
   rU   r   r]   rK   rX   rb   rY   r1   )r   rP   ZappendedrQ   r   _get_appended_rpm_ostree_kargsZ/BootloaderPlugin._get_appended_rpm_ostree_kargsJ  sW    
ii&223!YYv44|CQbll[( (!			0b0r   c                s    V P                  V P                  4       R7       V P                  \        P                  R/4       R# )z6Remove kernel parameter tuning in a rpm-ostree system.)r>   r   N)rB   rh   r_   r   rb   r   r*   r   _remove_rpm_ostree_tuningZ*BootloaderPlugin._remove_rpm_ostree_tuningP  s5    T-P-P-RS688"=>r   c                sB   V\         P                  8X  d   V P                  '       gv   V P                  '       d(   \        P                  R 4       V P                  4        R# \        P                  R4       V P                  4        V P                  RRRR/4       R# R# R# )z4removing rpm-ostree tuning previously added by Tunedz/removing grub2 tuning previously added by Tunedtuned_paramsr   tuned_initrdN)	r   ZROLLBACK_FULLr   r   r/   rW   rj   rg   _update_grubenv)r   r   Zrollback   &&&r   _instance_unapply_staticZ)BootloaderPlugin._instance_unapply_staticU  sy    %%%d.H.H.H
HHCD""$HH>?.2~CD /I%r   c                s$   \         P                  R 4       \        P                  ! R\        P
                  ,           R,           RV\        P                  R7      p\        P                  ! R\        P
                  ,           RV\        P                  R7      p\        P                  ! R\        P                  ,           R,           RV\        P                  R7      p\        P                  ! R\        P                  ,           RV\        P                  R7      p\        P                  ! \        P                  R,           RV\        P                  R7      p\        P                  ! \        P                  R,           RV\        P                  R7      # )zunpatching grub.cfgz
^\s*set\s+z\s*=.*
r   rT   z *\$\nz\n+)
r/   r0   rK   rM   r   rd   rY   re   GRUB2_TEMPLATE_HEADER_BEGINGRUB2_TEMPLATE_HEADER_END)r   	grub2_cfgcfgs   && r   _grub2_cfg_unpatchZ#BootloaderPlugin._grub2_cfg_unpatch_  s    ))!"
}v555CR\^\h\hi#ffWv555r3U)
}v<<<{JBPYcecocop#ffWv<<<b#r||\)
v11E92yRTR^R^_#	00692sBLL	YYr   c                s   \         P                  R 4       R\        P                  ,           R,           pV F`  pVRV P                  P                  V4      ,           R,           V P                  P                  W$,          4      ,           R,           ,          pKb  	  V\        P                  R,           ,          p\        P                  ! RW1\        P                  R7      pR	\        P                  R
\        P                  /pV F  p\        P                  ! RV,           R,           RWV,          ,           V\        P                  R7      p\        P                  ! RV,           R,           WV,          ,           R,           RV\        P                  R7      p\        P                  ! RV,           R,           RV\        P                  R7      pK  	  V# )zinitial patching of grub.cfgz\1\n\n
zset z=""
rp   z+^(\s*###\s+END\s+[^#]+/00_header\s+### *)\nrT   ZlinuxZinitrdz^(\s*z(16|efi)?\s+.*)$z\1 $z(?:16|efi)?\s+\S+rescue.*)\$z *(.*)$z\1\2z(?:16|efi)?\s+\S+rescue.*) +$\1)r/   r0   r   rq   r
   rL   rr   rK   rM   rY   rd   re   )r   rs   r^   ZsoptZd2irA   r   _grub2_cfg_patch_initialZ)BootloaderPlugin._grub2_cfg_patch_initialh  sU   ))*+&444t;!c$))""3''%/$))2B2B162JJVSS1 v''%//!ffCQ[][g[gh)&(((V5R5RS"avvhl%88'BE/9^`^j^jk9vvhl%DDruLzY[bdmwy  xD  xD  E9vvhl%EEuiacamamn9  
r   c                s,   V P                   P                  \        P                  4      p\	        V4      ^ 8:  d-   \
        P                  R\        P                  ,          4       R# R\        P                  R\        P                  /pRpV F  p\        P                  ! RV,           R,           W$,          ,           R,           V\        P                  R7      e   KP  R	pVR,          R
8w  d
   VR
,          pWR,           V,           R,           V,           R,           W$,          ,           R,           ,          pK  	  V'       dU   \
        P                  R\        P                  ,          4       V P                   P                  \        P                  V4       R	# )    rS   FZGRUB_CMDLINE_LINUX_DEFAULTZGRUB_INITRD_OVERLAYz^[^#]*\bz
\s*=.*\\\$z\b.*$rT   Trv   z="${z:+$z }\$rw   zpatching '%s')r
   rU   r   rV   r2   r/   rW   rd   re   rK   rX   rY   r0   write_to_file)r   rZ   r^   writerz   r7   r   _grub2_default_env_patchZ)BootloaderPlugin._grub2_default_env_patchz  s$   ii))&*G*GH	q 88!>!>>?
#f&<&<>SV\VsVst!
%aiia-/!$6ACT^`^j^jksE$$Wq5014w>ENN  99_v<<<=99688:KL	r   c                s   V P                   P                  \        P                  4      p\	        V4      ^ 8:  d-   \
        P                  R\        P                  ,          4       R# Rp\        P                  ! R\        P                  ,           R,           V\        P                  R7      '       d^   Rp\        P                  ! R\        P                  ,           R,           RV\        P                  R7      pVR,          R	8w  d
   VR	,          pV'       dU   \
        P                  R
\        P                  ,          4       V P                   P                  \        P                  X4       R# )r|   rS   Fzb^GRUB_CMDLINE_LINUX_DEFAULT=\"\$\{GRUB_CMDLINE_LINUX_DEFAULT:\+\$GRUB_CMDLINE_LINUX_DEFAULT \}\\\$z"$rT   Tz"$
r   rv   zunpatching '%s'r}   )r
   rU   r   rV   r2   r/   rW   rK   rX   rd   rY   rM   r0   r~   )r   rZ   r   rt   r9   r   _grub2_default_env_unpatchZ+BootloaderPlugin._grub2_default_env_unpatch  s   ii))&*G*GH	q 88!>!>>?

%YYt	!"#4bllL LE
&&v%&')+<bllTC
2w$D[S
99!>!>>?99688#>	r   c           
     s   \         P                  R 4       V P                  '       g   \         P                  R4       R# V P                   EF  pV P                  P                  V4      p\        V4      ^ 8:  d   \         P                  RV,          4       KM  \         P                  RV,          4       TpRpV F  p\        P                  ! RV,           R,           RV P                  P                  W,          4      ,           R,           V\        P                  R7      w  rGV^8  g3   \        P                  ! R	V,           V\        P                  R7      e   K  R
pK  	  \        \        P                  ! R	\        P                  ,           V\        P                  R7      4      \        \        P                  ! R	\        P                  ,           V\        P                  R7      4      8w  d   R
pV'       d"   V P!                  V P#                  V4      V4      pV P                  P%                  W$4       EK  	  V P&                  '       d   V P)                  4        R
# V P+                  4        R
# )zpatching grub.cfgr`   Fzcannot patch %sz+adding boot command line parameters to '%s'z	\b(set\s+z\s*=).*$Z"rT   z\$Tz\1")r/   r0   r   rW   r
   rU   r2   rK   ZsubnrL   rY   rX   Zfindallr   rd   re   r{   ru   r~   r   r   r   )r   r^   rP   rs   Zgrub2_cfg_newZpatch_initialry   Znsubss   &&      r   _grub2_cfg_patchZ!BootloaderPlugin._grub2_cfg_patch  s   )) 		#	#	#88+,
%%ayy""1%9	)nHH"#99:Q>?==sWW\C%7+%E|VZV_V_VfVfghgmVnGnquGu  xE  OQ  O[  O[  \]qyBIIeck9bllKS]  
"**UV333Y
UV

56888)R\\Z[\]11$2I2I)2TVWXM991,) &* 
YYY""$ 
   "	r   c                s   V P                  4       pV P                  P                  4       pV P                  4       pVf   \        P                  R4       R# VP                  4       pV F  pVP                  V4       K  	  V Uu. uF  qUV9  g   K  VNK  	  ppW8X  d   \        P                  R4       R# V P                  WR7      '       d3   V P                  \        P                  RP                  V4      /4       R# R# u upi )z5Apply kernel parameter tuning in a rpm-ostree system.Nz?Not updating kernel arguments, could not read the current ones.z+Kernel arguments already set, not updating.)r>   r?   rF   )rh   r   r1   r=   r/   r<   ZremoverW   rB   r_   r   rb   join)r   Zappended_kargsZprofile_kargsZactive_kargsZnon_tuned_kargsr@   Zkargs_to_appends   &      r   _rpm_ostree_updateZ#BootloaderPlugin._rpm_ostree_update  s    668.##))+-++-,99NO	 &&(/d$ 
 '4Smd?7RTTm/S& 889:	 
"""]]F99CHH_<UVW ^ Ts   DDc                s   V P                  \        P                  V P                  \        P                  V P
                  /4       V P                  \        P                  V P                  \        P                  V P
                  /4       R # r    )	r   r   rd   r   re   r   r_   rb   rc   ri   r*   r   _grub2_updateZBootloaderPlugin._grub2_update  sp    //$2C2CVEbEbeieueuvw6884;L;LfNpNpsw  tD  tD  E  Fr   c                \    \         P                  P                  \        P                  4      # r    )r   r   rO   r   ZBLS_ENTRIES_PATHri   r*   r   _has_blsZBootloaderPlugin._has_bls  s    	//	00r   c           	     sj   \         P                  R \        V4      ,          4       VP                  4        UUu. uF   w  r#\        V4      : R\        V4      : 2NK"  	  pppV P                  P                  . ROV,           4      w  rVV^ 8w  d   \         P                  RV,          4       R# R# u uppi )zupdating grubenv, setting %s=zcannot update grubenv: '%s'FT)zgrub2-editenvrE   set)r/   r0   rH   Zitemsr
   r.   r3   )r   r^   ZoptionvalueZlr4   r5      &&     r   rm   Z BootloaderPlugin._update_grubenv  s    ))*SV34@A	J	}v#f+s5z*	!Jii = AB)21W;;,s23
	 Ks   &B/c                sL   V P                   P                  4       pVR 8X  d   R# \        P                  R\        P
                  ,          4       V P                   P                  \        P
                  R.RV/R7      w  r#V^ 8w  d   \        P                  RV,          4       R# R# )r   Fz4running kernel update hook '%s' to patch BLS entriesra   ZKERNEL_INSTALL_MACHINE_ID)Zenvzcannot patch BLS entries: '%s'T)r
   Zget_machine_idr/   r0   r   ZKERNEL_UPDATE_HOOK_FILEr.   r3   )r   Z
machine_idr4   r5   r9   r   _bls_entries_patch_initialZ+BootloaderPlugin._bls_entries_patch_initial  s    yy'')*2
))BVEcEccdii!?!? GPknxOyz)21W;;/#56
	r   c                s    \         P                  R 4       V P                  4       '       dH   V P                  RV P                  RV P
                  /4      '       d   V P                  4       '       d   R# R# )zupdating BLSrk   rl   TF)r/   r0   r   rm   r   r   r   ri   r*   r   _bls_updateZBootloaderPlugin._bls_update  sT    ))N	]]__$*;*;^dN^N^_``""$$	r   c                s    V P                   fS   \        P                  P                  \        P
                  \        P                  P                  V4      4      V n         R # R # r    )r   r   r   r   r   BOOT_DIRbasename)r   Znamer   r   _init_initrd_dst_imgZ%BootloaderPlugin._init_initrd_dst_img  s=    	% ggll6??BGG<L<LT<RS4 &r   c                r   r    )r   r   isdirr   ZPETITBOOT_DETECT_DIRri   r*   r   _check_petitbootZ!BootloaderPlugin._check_petitboot  s    	v22	33r   c                s   V P                   '       d   \        P                  R 4       R# V P                  4       '       d   \        P                  R4       \        P	                  RV P
                  ,          4       \        P                  P                  V P
                  4      pV P                  P                  WP
                  4      '       g   R# RV n        V P                  P                  R4      P                  4       pRp\        V4      pV'       d+   \        P                   ! RRV4      p\        V4      V8  d   Tp\        P                  P#                  WB4      V n        R# )	z:Detected rpm-ostree which doesn't support initrd overlays.FzkDetected Petitboot which doesn't support initrd overlays. The initrd overlay will be ignored by bootloader.zinstalling initrd image as '%s'T/proc/cmdline/z)^\s*BOOT_IMAGE=\s*(?:\([^)]*\))?(\S*/).*$rx   )r   r/   r3   r   rW   r   r   r   r   r
   rG   r   rU   Zrstripr2   rK   rM   r   r   )r   ZimgZimg_nameZcurr_cmdlineZinitrd_grubpathZlcr   r   r   _install_initrdZ BootloaderPlugin._install_initrd  s    	;;KL
	;;|}((,t/G/GGHWWd667(	55	6	6
$$$_5<<>,/
<"
&&=ul
S4	$i"nOWW\\/<$	r   r#   c                s\    V'       d   R # V'       d   Ve   \        V4      .V n        R # R # R # r    )rH   r   r   enablingr   verifyignore_missingr      &&&&&&r   _grub2_cfg_fileZ BootloaderPlugin._grub2_cfg_file  s'     
%#!$U4 $Xr   r$   c                s*   V'       d   R # V'       d   Ve}   \        V4      V n        V P                  R8X  d   R# V P                  ^ ,          R8X  d   R# \        P                  P	                  \
        P                  V P                  4      V n        R# R # )Nr   Fr   T)rH   r   r   r   r   r   r   r   r   r   _initrd_dst_imgZ BootloaderPlugin._initrd_dst_img!  sl     
%#!%j4
"$
q!S( ggll6??D<T<TU4
	r   r'   c                s|    V'       d   R # V'       d*   Ve&   V P                   P                  V4      R8H  V n        R# R # )N1T)r
   get_boolr   r   r   r   r   Z#BootloaderPlugin._initrd_remove_dir0  s4     
%#!YY//6#=4
	r   r%   F)Z
per_deviceZpriorityc                s    V'       d   R # V'       dE   VeA   \        V4      pV P                  V4       VR8X  d   R# V P                  V4      '       g   R# R# R # )Nr   FT)rH   r   r   )r   r   r   r   r   r   Zsrc_imgs   &&&&&& r   _initrd_add_imgZ BootloaderPlugin._initrd_add_img:  sM     
%#Z7W%m


w
'
'
	r   r&   c                s   V'       d   R # V'       Ed   VEe   \        V4      pV P                  V4       VR8X  d   R# \        P                  P	                  V4      '       g   \
        P                  RV,          4       R# \
        P                  RV,          4       \        P                  ! RRR7      w  rx\
        P                  RV,          4       \        P                  ! V4       V P                  P                  R	V,          VR
R7      w  r\
        P                  RV
,          4       V	^ 8w  d5   \
        P                  R4       V P                  P                  VR
R7       R# V P                  V4       V P                  P                  V4       V P                   '       d8   \
        P                  RV,          4       V P                  P#                  V4       R
# R # )Nr   FzFerror: cannot create initrd image, source directory '%s' doesn't existz+generating initrd image from directory '%s'ztuned-bootloader-z.tmp)ZprefixZsuffixz+writing initrd image to temporary file '%s'zfind . | cpio -co > %sT)ZcwdZshellzcpio log: %szerror generating initrd imagerR   zremoving directory '%s')rH   r   r   r   r   r/   r<   rW   tempfileZmkstempr0   Zcloser
   r.   rf   r   r   Zrmtree)r   r   r   r   r   r   Zsrc_dirZfdZtmpfiler4   r5   s   &&&&&&     r   _initrd_add_dirZ BootloaderPlugin._initrd_add_dirI  s[    
X%#Z7W%m
''--
 
 IIVY``a889GCD##-@6R=B99:WDE88B<yy  !9G!C7\` a9B99^c!"AgII-.IIW. 99G
HH&01IIW
	r   r(   c                sV   V P                   P                  V P                  P                  V4      4      pV'       Ed   V P                  '       d   V P                  4       pMV P                  P                  R 4      pVe   \        V4      ^ 8X  d   R# \        VP                  4       4      p\        VP                  4       4      p	W,
          p
\        V
4      ^ 8X  d8   \        P                  \        P                  R\        V	4      3,          4       R# V Uu/ uF  qfP                  R^4      ^ ,          VbK  	  ppV
 F  pVP                  R^4      ^ ,          pW9   g.   \        P                  \        P                   W3,          4       KO  \        P                  \        P"                  W,          V3,          4       K  	  W,          p\        P                  RRP%                  V4      : 24       R# V'       d)   Ve%   \        P                  R4       RV n        W`n        R# R# u upi )	r   Nr(   Tr   z0expected arguments that are present in cmdline: rF   Fz;installing additional boot command line parameters to grub2)Z
_variablesZexpandr
   Zunquoter   r=   rU   r2   r   r1   r/   rW   r   ZSTR_VERIFY_PROFILE_VALUE_OKrH   r<   Z'STR_VERIFY_PROFILE_CMDLINE_FAIL_MISSINGZSTR_VERIFY_PROFILE_CMDLINE_FAILr   r   r   )r   r   r   r   r   r   Zvr(   Zcmdline_setZ	value_setZmissing_setZcmdline_dictZmZargZpresent_sets   &&&&&&         r   _cmdlineZBootloaderPlugin._cmdlinei  s   
ooTYY..u56!V
((*Gii!!/2GoW*W]]_%;1779~9(;	+!HHV//9c)n2MMN3>?;aGGCOA&);L?773?1S	ii>>#IJ	ii66,:KQ9OOP  )KHH388KCXZ[%#88IJ4
	 @s   "H&r)   c                s    V'       d   R # V'       dC   Ve?   V P                   P                  V4      R8X  d   \        P                  R4       RV n        R# R # )Nr   z(skipping any modification of grub configT)r
   r   r/   rW   r   r   r   r   _skip_grub_configZ"BootloaderPlugin._skip_grub_config  sB    
%#
ii3&HH78!%D	r   c                sT   V'       d   V P                   '       d   \        V P                  4      ^ 8  d   \        P	                  R4       \        V P
                  4      ^ 8  d   \        P	                  R4       V P                  \        P                  V P
                  \        P                  V P                  /4       R# V'       da   V P                  '       dM   V P                  '       d   V P                  4        M V P                  4        V P                  4        RV n
        R# R# R# )r|   z0requested changes to initrd will not be applied!z1requested changes to cmdline will not be applied!FN)r   r2   r   r/   r3   r   r_   r   rb   rc   r   r   r   r   r   )r   r   r   rn   r   _instance_post_staticZ&BootloaderPlugin._instance_post_static  s    $,,,	$

aKKBC	$

q KKCDF99D<M<MvOqOqtx  uE  uE  F  GD)))
 4 *xr   )
r   r
   r   r   r   r   r   r   r   r   )2rJ   Z
__module__Z__qualname__Z__firstlineno__Z__doc__r	   r   r"   Zclassmethodr+   r   r:   r=   rB   rN   r   r   r_   rg   rh   rj   r   ZROLLBACK_SOFTro   ru   r{   r   r   r   r   r   r   rm   r   r   r   r   r   Zcommand_customr   r   r   r   r   r   r   r   Z__static_attributes__Z__classdictcell__Z__classcell__)r   Z__classdict__s   @@r   r   r      s    ^@; 	 	- 24" " D%J	.1?
 :@9M9M EZ$&&@X4F1	T4* !"- #- !" # $% & !"E F !"E F> 2> ?B #%BG H! !r   r   )r   r   Z
decoratorsZ
tuned.logsZtunedr   Ztuned.utils.commandsr   Ztuned.constsr   r   rK   r   Ztimer   ZlogsZgetr/   ZPluginr   r!   r   r   <module>r      sE        )  	 	  jjnnU
!t{{ U
!r   