Current File : //proc/self/root/usr/lib/python3/dist-packages/cloudinit/distros/__pycache__/gentoo.cpython-312.pyc |
�
Nh~ � � � d dl Z d dlmZmZmZmZ d dlmZ d dlm Z d dl
mZmZ e j e� Z G d� dej � Zy)� N)�distros�helpers�subp�util)�PackageList)�HostnameConf)�
PER_ALWAYS�PER_INSTANCEc �t � e Zd ZdZdZddgZd� Zdd�Zdefd �Z d
� Z
d� Zed� � Z
dd
�Zd� Zdd�Zdd�d�Zy)�Distroz/etc/locale.genzen_US.UTF-8zC.UTF8 UTF-8zen_US.UTF-8 UTF-8c �� � t j j | |||� t j � rd| _ nd| _ t j |� | _ d| _ y )Nz
/etc/hostnamez/etc/conf.d/hostname�gentoo) r r �__init__�uses_systemd�hostname_conf_fnr �Runners�_runner�osfamily)�self�name�cfg�pathss �:/usr/lib/python3/dist-packages/cloudinit/distros/gentoo.pyr zDistro.__init__ sO � �������d�C��7����!�$3�D�!�$:�D�!�
���u�-��� ��
� Nc �� � t j | j dj | j � d�� t j
dgd�� t j
ddd | j gd�� y
)z�Locales need to be added to /etc/locale.gen and generated prior
to selection. Default to en_US.UTF-8 for simplicity.
�
i� )�modez
locale-genF��capture�eselect�locale�setN)r �
write_file�
locale_gen_fn�join�localesr �default_locale)r �_�out_fns r �apply_localezDistro.apply_locale+ s[ � �
����*�*�D�I�I�d�l�l�,C�#�N�
� � �<�.�%�0�
� � �
��%��)<�)<�=�u�
r �pkglistc �J � | j � | j d|�� y )N� )�pkgs)�update_package_sources�package_command)r r+ s r �install_packageszDistro.install_packages9 s! � ��#�#�%����R�g��.r c � � d } | j |� }|st d� }t j � r|j |� n|j d|z � t j |t |� d� y # t $ r> t j | j dd� }|rnt
j
d� Y y Y ��w xY w)N�create_hostname_fileTz8create_hostname_file is False; hostname file not createdr- z
hostname="%s"i� )
�_read_hostname_conf�IOErrorr �get_cfg_option_bool�_cfg�LOG�infor r r �set_hostnamer# �str)r �hostname�filename�confr3 s r �_write_hostnamezDistro._write_hostname= s� � ��� � �+�+�H�5�D� ���#�D����!�
���h�'�
���o��8�9�����#�d�)�U�3��3 �
�#'�#;�#;�� � �1�4�$� � $�����N�� � �
�s �A= �=AC�Cc �T � | j | j � }| j |fS �N)�_read_hostnamer )r �sys_hostnames r �_read_system_hostnamezDistro._read_system_hostname^ s) � ��*�*�4�+@�+@�A���$�$�l�2�2r c �b � t t j | � � }|j � |S rA )r r �load_text_file�parse)r= r>