403Webshell
Server IP : 159.69.118.108  /  Your IP : 216.73.216.231
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ubuntu-4gb-fsn1-1 6.8.0-90-generic #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 13:53:54 UTC 2025 aarch64
User : root ( 0)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/cloudinit/config/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/cloudinit/config/__pycache__/cc_raspberry_pi.cpython-312.pyc
�

��i�!�
�0�UddlZddlZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
eje�ZdZd	Zd
Zddd
d�ZdZdZdZdZdZddge
egd�Zeed<dedefd�Zdefd�Zdeeefdefd�Z de!dedefd�Z"d e!de	d!ed"e#ddf
d#�Z$y)$�N)�Union)�subp)�Cloud)�Config)�
MetaSchema)�PER_INSTANCE�rpi�
interfaces�enable_usb_gadget�do_spi�do_i2c�
do_onewire)�spi�i2c�onewire�serial�do_serial_cons�do_serial_hwz/usr/bin/rpi-usb-gadgetz(Rebooting to apply config.txt changes...�cc_raspberry_pizraspberry-pi-os)�id�distros�	frequency�activate_by_schema_keys�meta�enable�returnc�`�tjd|�tjj	t
�stj
dt
�y	tjt
|rdnddgdd��y	#tj$r }tj
d
|�Yd}~yd}~wwxYw)zEnable / Disable Raspberry Pi USB gadget mode when
    the script is present.

    Returns True when a reboot is required.
    zEnable rpi-usb-gadget mode: %sz#rpi-usb-gadget script not found: %sF�on�offz-f�)�capture�timeoutTz&Failed to configure rpi-usb-gadget: %sN)	�LOG�debug�os�path�exists�RPI_USB_GADGET_SCRIPT�errorr�ProcessExecutionError)r�es  �B/usr/lib/python3/dist-packages/cloudinit/config/cc_raspberry_pi.py�configure_usb_gadgetr-(s����I�I�.��7�
�7�7�>�>�/�0��	�	�7�9N�O����	�	�%���E��

���	
� ���%�%���	�	�:�A�>����s�#A:�:B-�
B(�(B-c�f�	tjgd��y#tj$rYywxYw)N)�/usr/bin/raspi-config�nonint�	is_pifiveTF)rr*��r,r1r1Ks/����	�	�B�C����%�%����s��0�0�cfgc�8�ddtdtfd�}d}d}t|t�r||d�}||d�}nt|t�r|}t	�s|rd}	tj
dd	tt|rd
nd�g�	tj
dd	tt|rd
nd�g�y#t
j$r }tjd|�Yd
}~yd
}~wwxYw#t
j$r }tjd|�Yd
}~yd
}~wwxYw)auConfigure the serial (UART) interface on Raspberry Pi.

    Depending on the configuration, this enables or disables
    the serial console and the hardware UART by invoking
    `raspi-config` non-interactively.

    Args:
        cfg: Either a boolean or a dictionary:
            - If a bool, enables or disables the serial
              console and hardware UART together.
            - If a dict, may contain the keys `console`
              and `hardware` with boolean values controlling
              each individually.

    Returns:
        True if the configuration was applied successfully,
        False otherwise.
    F�cfg_dict�namec��|j||�}t|t�stj	dt
||�|S|S)Nz"Invalid value for %s.serial.%s: %s)�get�
isinstance�boolr#�warning�RPI_INTERFACES_KEY)r6r7�default�vals    r,�get_bool_fieldz2configure_serial_interface.<locals>.get_bool_fieldgs@���l�l�4��)���#�t�$��K�K�4�"���	
��N��
r3�console�hardwareTr/r0r�z&Failed to configure serial console: %sNz'Failed to configure serial hardware: %s)F)�dict�strr:r;r1r�RASPI_CONFIG_SERIAL_CONS_FNr*r#r)�RASPI_CONFIG_SERIAL_HW_FN)r4r@�enable_console�	enable_hwr+s     r,�configure_serial_interfacerJSs��(
��
�S�
��N��I��#�t��'��Y�7��"�3�
�3�	�	�C��	����;�>��	���	�	�'��+���A�Q�/�	
�	
���	�	�'��)���A��*�	
�	
����%�%���	�	�:�A�>������%�%���	�	�;�Q�?����s0�*B0�*C&�0C#�C�C#�&D�9D�D�ifacec��|tj�vs
Jd|����	tjddt|t|rdnd�g�y#tj$r!}t
j
d||�Yd}~y	d}~wwxYw)
a�Enable or disable a supported hardware interface.

    Supported interfaces are defined in `SUPPORTED_INTERFACES` and
    currently include SPI, I2C, and 1-Wire. The function applies
    the change using `raspi-config` in non-interactive mode.

    Args:
        iface: The interface name (e.g. `"spi"` or `"i2c"`).
        enable: True to enable the interface, False to disable it.

    Returns:
        True if the interface configuration succeeded, False otherwise.
    zUnsupported interface: r/r0rrCTzFailed to configure %s: %sNF)�SUPPORTED_INTERFACES�keysrrEr*r#r))rKrr+s   r,�configure_interfacerO�s���	�%�*�*�,�,�)�	 ���(�)�,�
��	�	�'��$�U�+���A�Q�'�	
�	
����%�%���	�	�.��q�9����s�-A�B�#A?�?Br7�cloud�argsc��t|vryt|tt�s#tj	dt|t�y|tstjdt�yd}|tD�]�}|tk(r>|t|}t|t�r|t|�z}ntdt�����K|tk(�rbt|t|t�s'tj	dt|t|�y|t|stjd|�yt|t|j��}|D]�}|tj�vr%|tk7rtj	dt|��>|t||}|tk(rBt|ttf�stj	dt||�n|t|�z}��t|t�r|t!||�z}��tj	dt||������tj	d|����|dur8|j"j%d	d
t&��}	t)j(|	�yy)NzInvalid value for %s: %szEmpty value for %s. Skipping...FzInvalid value for zInvalid key for %s: %szInvalid value for %s.%s: %szUnsupported key: %sT�reboot�now)�mode�delay�message)�RPI_BASE_KEYr:rDr#r<r$�ENABLE_USB_GADGET_KEYr;r-�
ValueErrorr=�listrNrM�SERIAL_INTERFACErJrO�distro�shutdown_command�
REBOOT_MSGr)
r7r4rPrQ�want_reboot�keyr�subkeys�subkey�cmds
          r,�handlere�s[���3���
��L�)�4�
0����&�����	
�
	�
��
��	�	�3�\�B���K��<� �;���'�'���&�s�+�F��&�$�'��3�F�;�;�� �#5�6K�5L�!M�N�N��
�&�
&��c�,�/��4�d�;����.� ���%�c�*��
���&�s�+��	�	�;�S�A���3�|�,�S�1�6�6�8�9�G�"� 
���"6�";�";�"=�=��"2�2��K�K�0�2D�f����\�*�3�/��7���-�-�%�f�t�T�l�;����9�.�"�"�	�$�'A�&�'I�I����f�d�+��#6�v�v�#F�F�K��K�K�5�*���	�7 
�D
�K�K�-�s�3��w;�z�d���l�l�+�+����,�
��
	
�	�	�#��r3)%�loggingr%�typingr�	cloudinitr�cloudinit.cloudr�cloudinit.configr�cloudinit.config.schemar�cloudinit.settingsr�	getLogger�__name__r#rXr=rYrMr\rFrGr(r_r�__annotations__r;r-r1rDrJrErOr[rer2r3r,�<module>rps���	���!�#�.�+��g����!����!��+�������
��.��*��1��
7�
��!�"�� ,�~�	��j�� �� �$� �F�4��K�E�$��*�$5�K�$�K�\�s��D��T��DT��T�6�T�%�T�t�T��Tr3

Youez - 2016 - github.com/yon3zu
LinuXploit