File: //lib/python3.12/site-packages/tuned/plugins/__pycache__/plugin_script.cpython-312.opt-1.pyc
�
�]�i� � � � d dl mZ ddlmZ d dlZd dlZd dlmZm Z ej j � Z G d� dej � Zy)� N� )�base)�Popen�PIPEc �p � � e Zd ZdZed� � Zd� Zd� Zd� Z� fd�Z � fd�Z
ej f� fd� Z
� xZS ) �ScriptPlugina;
Executes an external script or binary when the profile is loaded or
unloaded. You can choose an arbitrary executable.
IMPORTANT: The `script` plug-in is provided mainly for compatibility
with earlier releases. Prefer other *TuneD* plug-ins if they cover
the required functionality.
*TuneD* calls the executable with one of the following arguments:
* `start` when loading the profile
* `stop` when unloading the profile
You need to correctly implement the `stop` action in your executable
and revert all settings that you changed during the `start`
action. Otherwise, the roll-back step after changing your *TuneD*
profile will not work.
Bash scripts can import the [filename]`/usr/lib/tuned/functions`
Bash library and use the functions defined there. Use these
functions only for functionality that is not natively provided
by *TuneD*. If a function name starts with an underscore, such as
`_wifi_set_power_level`, consider the function private and do not
use it in your scripts, because it might change in the future.
Specify the path to the executable using the `script` parameter in
the plug-in configuration.
.Running a Bash script from a profile
====
To run a Bash script named `script.sh` that is located in the profile
directory, use:
----
[script]
script=${i:PROFILE_DIR}/script.sh
----
====
c �
� dd iS )N�script� )�selfs �@/usr/lib/python3.12/site-packages/tuned/plugins/plugin_script.py�_get_config_optionsz ScriptPlugin._get_config_options1 s � � �d�
� � c �v � d|_ d|_ |j d �|j d |_ y g |_ y )NTFr
)�_has_static_tuning�_has_dynamic_tuning�options�_scripts�r �instances r
�_instance_initzScriptPlugin._instance_init7 s@ � � $�(��!&�(��
���h��+� �'�'��1�8���8�r c � � y )Nr r s r
�_instance_cleanupzScriptPlugin._instance_cleanupA s � �r c �l � d}|D �]q }t j }|j | j j � � | j |� st j dd|z z � �jt j d|�dt |� �d�� t j dt t |j � � � z � t |g|z t t d|dt j j! |� �� }|j# � \ }}t% |� rt j d |�d
|d d �d�� |j&